cURL / Mailing Lists / curl-library / Single Mail

curl-library

CURLOPT_POST is not returning anything

From: <nitin.mittal_at_rsa.com>
Date: Mon, 14 Dec 2009 01:07:33 -0500

Hi Issac/Jason/lars,

After inputs from all of you, I came up with the following code, but it
still doesn't work for me.

Can you please provide me your inputs/suggestions on this?

std::string strHttpContent="<s:Envelope
xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"
xmlns:a=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\"
xmlns:e=\"http://schemas.xmlsoap.org/ws/2004/08/eventing\"
xmlns:n=\"http://schemas.xmlsoap.org/ws/2004/09/enumeration\"
xmlns:w=\"http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\"><s:Header><a:
To>http://10.31.251.161:5985/wsman</a:To><w:ResourceURI
s:mustUnderstand=\"true\">http://schemas.microsoft.com/wbem/wsman/1/wind
ows/EventLog</w:ResourceURI><a:ReplyTo><a:Address
s:mustUnderstand=\"true\">http://schemas.xmlsoap.org/ws/2004/08/addressi
ng/role/anonymous</a:Address></a:ReplyTo><a:Action
s:mustUnderstand=\"true\">http://schemas.xmlsoap.org/ws/2004/08/eventing
/Subscribe</a:Action><w:MaxEnvelopeSize
s:mustUnderstand=\"true\">153600</w:MaxEnvelopeSize><a:MessageID>" +
strFormatName + "</a:MessageID><w:Locale xml:lang=\"en-US\"
s:mustUnderstand=\"false\" /><w:OptionSet
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><w:Option
Name=\"SubscriptionName\">RSAenVision</w:Option><w:Option
Name=\"ContentFormat\">RenderedText</w:Option><w:Option
Name=\"ReadExistingEvents\" xsi:nil=\"true\"/><w:Option
Name=\"IgnoreChannelError\"
xsi:nil=\"true\"/></w:OptionSet><w:OperationTimeout>PT60.000S</w:Operati
onTimeout></s:Header><s:Body><e:Subscribe><e:Delivery
Mode=\"http://schemas.dmtf.org/wbem/wsman/1/wsman/Pull\"><w:Heartbeats>P
T2000.000S</w:Heartbeats><w:Locale
xml:lang=\"en-US\"/><w:ContentEncoding>UTF-8</w:ContentEncoding></e:Deli
very><w:Filter
Dialect=\"http://schemas.microsoft.com/win/2004/08/events/eventquery\"><
QueryList><Query Id=\"0\"><Select Path=\"Application\">*</Select><Select
Path=\"System\">*</Select><Select
Path=\"Security\">*</Select></Query></QueryList></w:Filter><w:SendBookma
rks/></e:Subscribe></s:Body></s:Envelope>";
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)

curl_easy_setopt(mCurl, CURLOPT_POSTFIELDS, strHttpContent.c_str());

curl_easy_setopt(mCurl, CURLOPT_POSTFIELDSIZE, strHttpContent.length());

//pass headers
curl_easy_setopt(mCurl, CURLOPT_HTTPHEADER, &SOAPaction);
curl_easy_setopt(mCurl, CURLOPT_URL,"http://10.31.251.161:5985/wsman");
FILE * somefile=fopen("somelog.log","w");
curl_easy_setopt(mCurl,CURLOPT_WRITEDATA,somefile);//server response
curl_easy_perform(mCurl);

// always cleanup
curl_easy_cleanup(mCurl);

I am still not able to collect events from the server 10.31.251.161. &
an empty "somelog.log" file is created.

Thanks again for your help.

Regards.
Nitin

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2009-12-14