cURL / Mailing Lists / curl-library / Single Mail

curl-library

Do manually constructed SOAP queries work with libcurl?

From: <nitin.mittal_at_rsa.com>
Date: Thu, 28 Jan 2010 03:15:31 -0500

Hi,

Can manually constructed SOAP queries (as shown below) be sent using
"CURLOPT_POSTFIELDS" to windows 2008 server?

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/wmi/
root/cimv2/Win32_UTCTime </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/09/transfer
/Get</a:Action><w:MaxEnvelopeSize
s:mustUnderstand=\"true\">153600</w:MaxEnvelopeSize><w:OperationTimeout>
PT60.000S</w:OperationTimeout></s:Header><s:Body/></s:Envelope>";

Above is the SOAP "Get" query to get the current time of the remote
windows 2008 server 10.31.251.161.

I am using it like,

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

I have set my headers as follows:

headers = curl_slist_append(headers, "Content-Type: text/xml");
headers = curl_slist_append(headers, "SOAPAction: \"\"");
curl_easy_setopt(mCurl, CURLOPT_HTTPHEADER, headers);

I am not sure if SOAP queries like the one above, can be sent using
libcurl. Because what I get back from the server is " HTTP/1.1 415 "
which means,

10.4.16 415 Unsupported Media Type
The server is refusing to service the request because the entity of the
request is in a format not supported by the requested resource for the
requested method.

Please suggest.

Thanks,
Nitin
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-01-28