> Hi Nitin,
Add this line to your code after curl_easy_init(); curl_easy_setopt(mCurl, CURLOPT_VERBOSE, TRUE); This will help you know what happens at every level. Its like debugging. Regards, Issac > Hi Issac, Thanks for your reply. 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:coll...@234"); //set size of postfield data curl_easy_setopt(mCurl, CURLOPT_POSTFIELDSIZE, strHttpContent.length()); //pass headers curl_easy_setopt(mCurl, CURLOPT_HTTPHEADER, &SOAPaction); ///////////////////// char headerfilename[FILENAME_MAX] = "head.out"; FILE *headerfile; errNum = curl_easy_setopt(mCurl, CURLOPT_WRITEFUNCTION,&write_data); headerfile = fopen(headerfilename,"w"); if (headerfile == NULL) { curl_easy_cleanup(mCurl); return; } errNum = curl_easy_setopt(mCurl, CURLOPT_WRITEHEADER ,headerfile); errNum = curl_easy_perform(mCurl); if (CURLE_OK != errNum) { exit(EXIT_FAILURE); } fclose(headerfile); curl_easy_cleanup(mCurl); ************************************************************************ ************************ & after setting CURLOPT_VERBOSE to TRUE, I get the following information on stdout. ///////////// * About to connect() to 10.31.251.161 port 5985 (#0) * Trying 10.31.251.161... * connected * Connected to 10.31.251.161 (10.31.251.161) port 5985 (#0) * Server auth using Basic with user 'administrator' > POST /wsman HTTP/1.1 Authorization: Basic YWRtaW5pc3RyYXRvcjpjb2xsZWN0QDIzNA== Host: 10.31.251.161:5985 Accept: */* Content-Length: 1748 Content-Type: application/x-www-form-urlencoded Expect: 100-continue < HTTP/1.1 100 Continue The body is <body.out> < HTTP/1.1 415 < Server: Microsoft-HTTPAPI/2.0 < Date: Wed, 16 Dec 2009 08:25:41 GMT < Connection: close < Content-Length: 0 < * Closing connection #0 ///////////////// Seems like, the connection is established successfully but curl_easy_setopt(mCurl, CURLOPT_POSTFIELDS, strHttpContent.c_str()); Couldn't POST the contents of strHttpContent, which is: 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/window s/EventLog</w:ResourceURI><a:ReplyTo><a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing /role/anonymous</a:Address></a:ReplyTo><a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/eventing/S ubscribe</a:Action><w:MaxEnvelopeSize s:mustUnderstand="true">153600</w:MaxEnvelopeSize><a:MessageID>uuid:876d 1849-ae64-474f-aada-a9d63636616a</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:Operation Timeout></s:Header><s:Body><e:Subscribe><e:Delivery Mode="http://schemas.dmtf.org/wbem/wsman/1/wsman/Pull"><w:Heartbeats>PT2 000.000S</w:Heartbeats><w:Locale xml:lang="en-US"/><w:ContentEncoding>UTF-8</w:ContentEncoding></e:Delive ry><w:Filter Dialect="http://schemas.microsoft.com/win/2004/08/events/eventquery"><Qu eryList><Query Id="0"><Select Path="Application">*</Select><Select Path="System">*</Select><Select Path="Security">*</Select></Query></QueryList></w:Filter><w:SendBookmark s/></e:Subscribe></s:Body></s:Envelope>"; Could you please suggest something here? Thanks & Regards, Nitin ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.html ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.html
