cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Regarding creating a handle to the SOAP string response

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Thu, 15 Sep 2011 23:47:53 -0700

On Thu, Sep 15, 2011 at 11:36:47PM -0700, abhishek Kalapatapu wrote:
> I am trying to send a SOAP request to a webservice and receive the response
> back using C. I was directed to an example of "simplepost.c" and using that, I
> am able to send and print a SOAP response back from a web service on my command
> line. But instead of printing the response on the screen, I want a handle to
> the response string, so that I am able to extract the values inside the SOAP
> tags. I have the following send and receive program written, but i am not able
> to receive proper response, which means either there is problem in sending or
> receiving. If any one can help me locate how exactly can I achieve, what i
> want, it would be really helpful. Thanks in advance.

You will need to install a write callback handler to handle the received
data. Take a look at the getinmemory.c example program, for instance.

>     curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L);
[...]
>     res = curl_easy_send(curl,request, strlen(request), &iolen);
[...]
>   res = curl_easy_recv(curl, buf, 10240, &iolen);

These certainly didn't come from simplepost.c. You almost never need any of
these calls--that's not how libcurl is designed to work for simple transfers
like you're doing.

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-09-16