locked
How should i call the webservice using win32 + c++ RRS feed

  • Question

  • Hi All,

    I have one webservice link exp https://xtz.com and with service ineed to send JSON data to authenticate (To get response). I have tried with SoupUI tool in that i did "REST" call method i select as POST and i copied my JSON format data into given space to send request data and I am able to get the response but i am not getting any code for win32 + c++ , using that i can call my service and send request to get the response. Kindly let me know if there are any code kindly share with me i need soon. I have sucked due to that in my project.

    Thanks,

    Yogendra Kumar 


    yogendra kumar

    Thursday, June 9, 2016 7:27 PM

Answers

All replies

  • Hi Yogendra

    Thanks for posting here.

     

    >> Kindly let me know if there are any code kindly share with me i need soon.

    With the C++ REST SDK (codename "Casablanca"), you could more easily connect to HTTP servers from your C++ app. Try to use the web::http::client::http_client class to create an HTTP GET request. The web::http::client::http_response class represents the server’s response.

    For more information, please refer to the bellowing document.

    https://msdn.microsoft.com/en-us/library/jj950081.aspx

    And here also has a blog about how to use the C++ REST SDK you could refer to.

    https://msdn.microsoft.com/en-us/magazine/dn342869.aspx?f=255&MSPPError=-2147217396

     

    Best Regards,

    Sera Yu


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.

    • Proposed as answer by Eddie Lotter Wednesday, June 15, 2016 1:24 PM
    • Marked as answer by Hart Wang Monday, June 20, 2016 8:10 AM
    Friday, June 10, 2016 1:34 AM
  • I have to add some more detail that i have webservice link as "https://test.com" and for authentication i have to send the data as showing 

    {
                    "ProcName": "SiteCreate",
                    "SenderID": "windows",
                    "Data": {
                                    "ID": "eeXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXe1",
                                    "ConnectionToken": "ee3eeXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX6c",
                                    "InSiteLocation": "1",
                                    "AttachedToken": "",
                                    "AttachedUserName": "yogendra",
                                    "RuleToken": "",
                                    "Message": "Authentication",
                                    "NotifyURL": null,
                                    "NotifyMethod": 1,
                                    "ForceFingerprint": false,
                                    "ForceFromPush": false,
                                    "ForceFace": false,
                                    "ForceHardware": false,
                                    "UseZeroTouch": null,
                                    "RequestType": 1,
                                    "IsAPICall": true
                    }
    }

    so while i call the webservice i need to send this JSON format data to authenticate and then i can get the response. but how does i will call in c++ i am not able to get i have seen some example but those are in xml/SOAP format using "IXMLHTTPRequest" where we need to send the string in xml format.


    yogendra kumar


    Friday, June 10, 2016 5:38 AM
  • We apologize for the delay and hoping that won't take too much inconvenience to you.

    In my last reply, you could know how to connect to HTTP with C++ REST SDK. You can parse JSON data faster by using the C++ REST SDK (codename "Casablanca") web::json namespace. Here is a document you could refer to.

    https://msdn.microsoft.com/en-us/library/jj950082.aspx

    And also a sample about send JSON data with XMLHttpRequest.

    http://www.w3schools.com/json/json_http.asp

    Hope that could help.

    Best Regards,

    Sera Yu


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.

    • Proposed as answer by Baron Bi Monday, June 20, 2016 8:09 AM
    Monday, June 13, 2016 8:24 AM
  • Thanks a lot


    yogendra kumar

    Tuesday, June 14, 2016 8:17 PM
  • If my answer has solved your problem, please help to mark and finish. Your understanding and cooperation will be grateful.

    Best Regards,

    Sera Yu


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.

    Friday, June 17, 2016 7:26 AM