Results 1 to 4 of 4

Thread: QtSoap - Problems extracting values from a QtSoapMessage

  1. #1
    Join Date
    Aug 2007
    Posts
    1

    Question QtSoap - Problems extracting values from a QtSoapMessage

    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:
    Qt Code:
    1. QtSoapSimpleType *type1 = new QtSoapSimpleType(QtSoapQName("key"), 20);
    2. QtSoapSimpleType *type2 = new QtSoapSimpleType(QtSoapQName("value"), 40);
    3.  
    4. QtSoapMessage response;
    5. response.setMethod(QtSoapQName("Response"));
    6. response.addMethodArgument(type1);
    7. 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:
    Qt Code:
    1. soapMessage.setContent(data);
    2. 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:
    Qt Code:
    1. <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" >
    2. <SOAP-ENV:Body xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    3. <Response>
    4. <key xsi:type="xsd:int" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" >20</key>
    5. <value xsi:type="xsd:int" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" >40</value>
    6. </Response>
    7. </SOAP-ENV:Body>
    8. </SOAP-ENV:Envelope>
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QtSoap - Problems extracting values from a QtSoapMessage

    Can you somehow list the contents of "res"?

  3. #3
    Join Date
    Dec 2007
    Posts
    6
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QtSoap - Problems extracting values from a QtSoapMessage

    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

  4. #4

    Default Re: QtSoap - Problems extracting values from a QtSoapMessage

    I have this same problem, like Baz. Maybe someone knows how?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.