PDA

View Full Version : QtSoap - Problems extracting values from a QtSoapMessage



Baz
28th August 2007, 17:19
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);

I sent this message to my client and tried to extract the added values:

soapMessage.setContent(data);
const QtSoapType &res = soapMessage.returnValue();

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>

wysota
19th September 2007, 10:55
Can you somehow list the contents of "res"?

alemark
17th December 2007, 18:24
Hi,

you might also want to take a look at this:
http://www.clausmark.com/feast_en.phtml

FEAST can also be used in a pure client role. The advantage over Qt SOAP is that is supports generating the client (and server) code based on the WSDL description (that you should get from the server). That way you don't have to worry about the details of the SOAP implementation. You will get a normal function that you can call from your client.
The generation of the SOAP envelope, serialization, de-serialization and mapping of Qt types to and from SOAP types are handled by FEAST.

/Niklas

Dr.Kiborg
4th December 2009, 08:52
I have this same problem, like Baz. Maybe someone knows how?