Hi,
i would like to use QtSoap for communication between a GUI and a serverengine - but i have to admit that i havn't worked with SOAP before, so please be indulgent 
I have a Problem extracting values from the SOAP-Message. I took a look at Trolltec's example that comes with QtSoap. It's about using Google's SOAP interface - unfortunately Google shut it down, and i dont have a API Key for SOAP. Therefore i tiried to create a SoapMessage by myself:
QtSoapSimpleType *type1 = new QtSoapSimpleType(QtSoapQName("key"), 20);
QtSoapSimpleType *type2 = new QtSoapSimpleType(QtSoapQName("value"), 40);
QtSoapMessage response;
response.setMethod(QtSoapQName("Response"));
response.addMethodArgument(type1);
response.addMethodArgument(type2);
QtSoapSimpleType *type1 = new QtSoapSimpleType(QtSoapQName("key"), 20);
QtSoapSimpleType *type2 = new QtSoapSimpleType(QtSoapQName("value"), 40);
QtSoapMessage response;
response.setMethod(QtSoapQName("Response"));
response.addMethodArgument(type1);
response.addMethodArgument(type2);
To copy to clipboard, switch view to plain text mode
I sent this message to my client and tried to extract the added values:
soapMessage.setContent(data);
const QtSoapType &res = soapMessage.returnValue();
soapMessage.setContent(data);
const QtSoapType &res = soapMessage.returnValue();
To copy to clipboard, switch view to plain text mode
Now it should be possible to get the value of the method arguments with res["argument name"], but all i get is an empty string. If i try to validate the result with res.Valid() it returns true, so it should be correct. Am I doing anything wrong?
Ah - here is the SOAP message i created:
<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/">
<Response>
<key xsi:type="xsd:int" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" >20</key>
<value xsi:type="xsd:int" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" >40</value>
</Response>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
<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/">
<Response>
<key xsi:type="xsd:int" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" >20</key>
<value xsi:type="xsd:int" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" >40</value>
</Response>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
To copy to clipboard, switch view to plain text mode
Bookmarks