I am developing an application which needs to use a web service.
Web service is running on the remote server and it accepts POST request and returns a JSON data
Here is the sample to consume service using “curl”
curl -F "api_key=ABCDEFGHIJKL" -F "query=@json_string.json" "http://serv/api/v4/song/identify"
An HTTP POST request with Content-Type “multipart/form-data” where all parameters are in the post body and the query is in the “query” parameter of the post “files”
So how could I implement client to consume the service in .NET
You could use a WCF REST service and parse the multipart/form-data.
UPDATE:
Sorry, I misread your question. You were looking for how to write the client. In a blog post of mine I suggested a sample class that allows to upload multiple files to a
multipart/form-dataenabled service along with parameters. It goes like this:and then a method to do the job:
and finally the client: