curl-library
Re: CURLOPT_URL returning FALSE
Date: Tue, 15 Dec 2009 09:38:55 +0000
On 12/15/2009 08:32 AM, nitin.mittal_at_rsa.com wrote:
> So, I added the line suggested by you in my code.& post modification,
> my code looks like:
>
>
> ************************************************************************
> ************************
> struct curl_slist SOAPaction;
> struct curl_slist content_type;
>
> memset(&SOAPaction, 0, sizeof(SOAPaction));
> memset(&content_type, 0, sizeof(content_type));
>
> content_type.data = "Content-Type: text/xml";
> SOAPaction.data = "SOAPAction: \"\""; /* Empty SOAPAction is the ID-WSF
> (and SAML?) standard */
>
> SOAPaction.next =&content_type; //curl_slist_append(3)
>
> mCurl = curl_easy_init();
> curl_easy_setopt(mCurl, CURLOPT_VERBOSE, TRUE);
>
> curl_easy_setopt(mCurl, CURLOPT_URL,"http://10.31.251.161:5985/wsman");
>
> curl_easy_setopt(mCurl, CURLOPT_POST, 1);
>
> curl_easy_setopt(mCurl, CURLOPT_POSTFIELDS, strHttpContent.c_str());
>
> curl_easy_setopt(mCurl, CURLOPT_USERPWD, "administrator:collect_at_234");
>
> //set size of postfield data
> curl_easy_setopt(mCurl, CURLOPT_POSTFIELDSIZE, strHttpContent.length());
>
> //pass headers
> curl_easy_setopt(mCurl, CURLOPT_HTTPHEADER,&SOAPaction);
Where is the curl header append function for your code???
I think its safe and less error prone if you follow the standard.
Do this:
struct curl_slist *content_type=NULL; //note the pointer here
headers = curl_slist_append(content_type, "Content-Type: text/xml");
curl_easy_setopt(mCurl, CURLOPT_HTTPHEADER, content_type);
SOAP is just xml over http so its crucial that if you will use libcurl
you use the standard of using the pointer to curl_slist layout above so
you can pass the right headers with post.
1)Create a header pointer and append the header type.
2)set the header to your handle
3)call perform();
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2009-12-15