I’m triing to get soap to work in qt
i found: qtsoap-2.7_1-opensource
my request code:
void DataConnector::checkLogin(QString username, QString password){
QtSoapMessage request;
request.setMethod(QtSoapQName("checkLogin","http://service/"));
request.addMethodArgument("username","",username);
request.addMethodArgument("password","",password);
http->setAction("");
http->submitRequest(request, QString("/datacheckService"));
}
the request soap message looks like this:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<checkLogin xmlns="http://service/">
<username xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">4444</username>
<password xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">4444</password>
</checkLogin>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
the server doesn’t detect the username and password tags because they have the wrong namespace.
the problem is that the username and password should get an attribute: xmlns:=””, instead of no namespace. cause no namespace means they take over the namespace of their parent
my request should look like this:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<checkLogin xmlns="http://service/">
<username xmlns="" xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">4444</username>
<password xmlns="" xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">4444</password>
</checkLogin>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
any ideas on how i achieve this using the qtsoap code?
The problem is within QtSoap code
just search where the xmlns=”” should be added to the soap message in the qtsoap source code
and edit the if construction so that it also adds it when the string is “”
fixed the problem for me
if you want the source: message me and i’ll send it