curl-users
xml post problem
Date: Tue, 23 Mar 2010 20:16:34 +0200
Hi I am trying to figure out the problem in my program for 3 days now, any
help would be most welcome.
I am sending the xml with following code:
char* str1 = "<soapenv:Envelope xmlns:soapenv=\"
http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"
http://services.aonaware.comwebservices/\"><soapenv:Header/><soapenv:Body><web:Define><web:word>";
char* str2 = argv[1];
char* str3 =
"</web:word></web:Define></soapenv:Body></soapenv:Envelope>";
int xmlstrlen = strlen(str1) + strlen(str2) + strlen(str3) + 4;
char* xmlstr = (char*) malloc (sizeof(char)*(xmlstrlen));
strcpy(xmlstr,str1);
strncat(xmlstr,str2,strlen(str2));
strncat(xmlstr,str3,strlen(str3));
/* std::string str1="<soapenv:Envelope xmlns:soapenv=\"
http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"
http://services.aonaware.comwebservices/\"><soapenv:Header/><soapenv:Body><web:Define><web:word>";
std::string str2 = argv[1];
std::string
str3="</web:word></web:Define></soapenv:Body></soapenv:Envelope>";
std::string str4 = "";
str4.append(str1);
str4.append(str2);
str4.append(str3);
const char* xmlstr = str4.c_str();
*/
// char* xmlstr = "<soapenv:Envelope xmlns:soapenv=\"
http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"
http://services.aonaware.com/webservices/
\"><soapenv:Header/><soapenv:Body><web:Define><web:word>hello</web:word></web:Define></soapenv:Body></soapenv:Envelope>";
curl_easy_setopt(ctx,CURLOPT_POSTFIELDS, xmlstr);
curl_easy_setopt(ctx,CURLOPT_POST, 1L);
The problem is when I send xml with last commented line the program works
but since I need to place <web:word> from command line I need to concat 3
char strings and feed them to CURLOPT_POSTFIELDS , when I do that it does
not work. I have checked the traffic with TCPmon and the two xmls sent above
are identical yet one works and another not. the server response I get is as
follows:
HTTP/1.1 500 Internal Server Error
Date: Tue, 23 Mar 2010 17:33:37 GMT
Server: Microsoft-IIS/6.0
MicrosoftOfficeWebServer: 5.0_Pub
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Content-Length: 629
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="
http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="
http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><faultcode>soap:Client</faultcode><faultstring>Parameter
not specified (null)
Parameter name: word</faultstring><faultactor>
http://services.aonaware.com/DictService/DictService.asmx</faultactor><detail><Error
xmlns="http://services.aonaware.com/webservices/"><ErrorMessage>Parameter
not specified (null)
Parameter name:
word</ErrorMessage></Error></detail></soap:Fault></soap:Body></soap:Envelope>
can any body figure out what the problem is.
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-03-23