How to create a client side and server side for c++ rest sdk using json

Jul 2, 2014 at 11:17 AM
client side :
Create a client that does the following
Reads in a large text file
connects to a rest based api and sends the document(text file) in a Json message
Waits for a response from the server and saves the response to a flat file

server side :
Create a Web service that is rest based that takes Json messages
Client will send a message in Json format
Server will receive message
It will take the body of the message which will be a document(text file) and run one of the replace the particular string on it
It will return the replace the string document in the response rest message

Please Help Me.. give me any example code.. I run on visual studio 2013.. i used the tool for cpp rest sdk 2.0.1 and windows 7 OS..
Jul 4, 2014 at 5:59 AM

Please Help me.. Give me the solution..

Jul 7, 2014 at 10:22 PM
Hi Bharatij

I would suggest going through our samples (under Release\samples folder) and testcases (under Release\tests\functional\http) to understand how to use the C++ REST SDK.

Some examples:
To create a client that reads a text file and send document to the server: refer http_client testcase request_stream_tests::set_body_stream_1.
Server that reads from a text file and responds to a message: refer http_listener testcase response_stream_tests::set_body_stream_small.

Please try out the different APIs on the http_client, http_listener, http_request, http_response classes to suit your needs (like setting the content type for JSON, or reading data from the request/response to in-memory stream etc).