cURL / Mailing Lists / curl-library / Single Mail

curl-library

Sending a SOAP response by passing values.

From: abhishek Kalapatapu <abhisrk_at_gmail.com>
Date: Thu, 22 Sep 2011 17:16:16 -0700

Hello,

I am not able to see any example, where in I can pass values to my SOAP
response and then using libcurl i can send it to a webservice.

Below is my code:

#include <stdio.h>
#include <curl/curl.h>

int main(void)
{
  CURL *curl;
  CURLcode res;

 struct curl_slist *headerlist=NULL;

const char *temp = "<?xml version=\"1.0\" encoding=\"utf-8\"?> <S:Envelope
xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\"> <S:Header/>
 <S:Body> <ns2:storeTransactions xmlns:ns2=\"http://desktop/\">
<deviceID>0a:40:16:f9:3b:0a</deviceID> <peerID>0a:40:0a:a0:3b:0a</peerID>
<perMatch>.4</perMatch> <profMatch>".4"</profMatch> </ns2:storeTransactions>
</S:Body> </S:Envelope>";

//printf("%s",temp);

curl = curl_easy_init();
  if(curl) {
    /* First set the URL that is about to receive our POST. This URL can
       just as well be a https:// URL if that is what should receive the
       data. */
    curl_easy_setopt(curl, CURLOPT_URL, "
http://eon.sdsu.edu:8080/SmartbadgePortal/PersonalInterestsService");
    /* Now specify the POST data */
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
headerlist = curl_slist_append(headerlist, "Content-Type: text/xml");
    curl_easy_setopt(curl, CURLOPT_POSTFIELDS, temp);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist);

    /* Perform the request, res will get the return code */
    res = curl_easy_perform(curl);

    /* always cleanup */
    curl_easy_cleanup(curl);
  }
  return 0;
}

Now inside the response at few places like "device id" "peer id"

Any idea how to do that......Thanks in advance.

-- 
*Cheers*
*Abhishek Kalapatapu*

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