i attempting use gsoap in c++ client access salesforce.com api using below code:
struct soap soap; soap_init(&soap); _ns1__login loginreq; _ns1__loginresponse loginres; loginreq.username = "xxxx"; loginreq.password = "xxxx"; if(soap_call___ns1__login(&soap,null,null,&loginreq,&loginres) == 0){ qdebug() << loginres.result->sessionid; } else { soap_print_fault(&soap, stderr); soap_print_fault_location(&soap, stderr); } this complies without problem when run produces following error:
soap 1.1 fault: soap-env:client [no subcode] "validation constraint violation: tag name or namespace mismatch in element <soapenv:envelope>" detail: [no detail] http/1.1 500 internal server error server: content-type: text/xml; charset=utf-8 content-length: 625 date: fri, 29 apr 2011 00:56:17 gmt connection: close <?xml version="1.0" encoding="utf-8"?><soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sf="urn:fault.enterprise.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"><soapenv:body><soapenv:fault><faultcode>unknown_exception</faultcode><faultstring>unknown_exception: premature end of file.</faultstring><detail><sf:unexpectederrorfault xsi:type="sf:unexpectederrorfault"><sf:exceptioncode>unknown_exception</sf:exceptioncode><sf:exceptionmessage>premature end of file.</sf:exceptionmessage></sf:unexpectederrorfault></detail></soapenv:fault></soapenv:body></soapenv:envelope> <!-- ** here ** --> i have run packet capture , looks correct except 'content-length' in http header shows 0:
post /services/soap/c/21.0 http/1.1 host: login.salesforce.com user-agent: gsoap/2.7 content-type: text/xml; charset=utf-8 content-length: 0 connection: close soapaction: "" <?xml version="1.0" encoding="utf-8"?> <soap-env:envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:ns2="urn:sobject.enterprise.soap.sforce.com" xmlns:ns3="urn:fault.enterprise.soap.sforce.com" xmlns:ns1="urn:enterprise.soap.sforce.com"><soap-env:body soap-env:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/"><ns1:login><ns1:username>xxxx</ns1:username><ns1:password>xxxx</ns1:password></ns1:login></soap-env:body></soap-env:envelope> if has insights going wrong appreciated.
i using gsoap 2.7 on debian 6.0 using g++ 4.4.5 compile if help.
this old question, had same issue recently. issue me was mixing c++ code , c code. i'd compiled stdsoap2.c rather stdsoap2.cpp , reason prevented correct count being made content-length. once created correct object , re-linked it, solution worked perfectly
Comments
Post a Comment