Results 1 to 10 of 10

Thread: QHttp to Soap Server

  1. #1
    Join Date
    Jul 2006
    Posts
    126
    Thanks
    17
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QHttp to Soap Server

    Can I send a Soap call with QHttp?

    I need a example too.

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

    Default Re: QHttp to Soap Server

    Yes. Just format a message according to soap rules and issue a request using QHttp.

  3. #3
    Join Date
    Jul 2006
    Posts
    126
    Thanks
    17
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QHttp to Soap Server


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

    Default Re: QHttp to Soap Server

    Quote Originally Posted by xgoan
    I don't think this qualifies as a Qt-related question... If you looked at the WSDL file provided on that webpage, you'd notice this entry:

    <wsdl:service name="SendService">
    <documentation xmlns="http://schemas.xmlsoap.org/wsdl/">Methods to send SMS messages individually and in batches. Click here for a &lt;a href="https://www.esendex.com/uk/evaluation/evaluation.aspx" title="SMS Service Trial"&gt;free trial&lt;/a&gt;.</documentation>
    <wsdl:port name="SendServiceSoap" binding="tns:SendServiceSoap">
    <soap:address location="http://www.esendex.com/secure/messenger/soap/sendservice.asmx" />
    </wsdl:port>

    </wsdl:service>
    and everything would be clear...

    BTW. If you click on the message name (on the page you mentioned), you'll get an example of a formatted http message needed to access that method:
    http://www.esendex.com/secure/messen...endMessageFull

  5. The following user says thank you to wysota for this useful post:

    xgoan (14th September 2006)

  6. #5
    Join Date
    Jul 2006
    Posts
    126
    Thanks
    17
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QHttp to Soap Server

    I have done it and works, here is the code to someone else.

    Qt Code:
    1. bool HttpGet::getFile(const QUrl &url)
    2. {
    3. http.setHost(url.host(), url.port(80));
    4. QByteArray byteArray("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
    5. "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
    6. " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" "
    7. " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"> \n"
    8. " <soap:Header>\n"
    9. " <MessengerHeader xmlns=\"com.esendex.ems.soapinterface\">\n"
    10. " <Username>username</Username>\n"
    11. " <Password>password</Password>\n"
    12. " <Account>account</Account>\n"
    13. " </MessengerHeader>\n"
    14. " </soap:Header>\n"
    15. " <soap:Body>\n"
    16. " <SendMessageFull xmlns=\"com.esendex.ems.soapinterface\">\n"
    17. " <originator>dsfs</originator>\n"
    18. " <recipient>telefono</recipient>\n"
    19. " <body>string</body>\n"
    20. " <type>Text</type>\n"
    21. " <validityperiod>24</validityperiod>\n"
    22. " </SendMessageFull>\n"
    23. " </soap:Body>\n"
    24. "</soap:Envelope>\n");
    25. cout<<byteArray.data()<<endl;
    26. http.setHost(url.host());
    27. QHttpRequestHeader header("POST" ,"/secure/messenger/soap/sendservice.asmx");
    28. header.setValue("Host", "www.esendex.com");
    29. header.setValue("Content-Type", "text/xml; charset=utf-8");
    30. header.setValue("SOAPAction", "com.esendex.ems.soapinterface/SendMessageFull");
    31. http.request(header,byteArray,&file);
    32. http.close();
    33. return true;
    34. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by jacek; 14th September 2006 at 21:12. Reason: reformatted to look better

  7. The following 2 users say thank you to xgoan for this useful post:

    ComaWhite (9th March 2008), sunil.thaha (15th September 2006)

  8. #6
    Join Date
    Nov 2008
    Posts
    9
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: QHttp to Soap Server

    hi,
    if u want to retrieve the object from the soap message then how do u do it?
    thanks

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

    Default Re: QHttp to Soap Server

    What do you mean by "the object"? What object?

  10. #8
    Join Date
    Nov 2008
    Posts
    9
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: QHttp to Soap Server

    the object is nothing but the data in the soap response. eg : temperature from the response given by the weather web service. how can i retrieve it?
    Last edited by rohan_m_e; 9th December 2008 at 10:43.

  11. #9
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QHttp to Soap Server

    I suppose you must only one time login && at end logout...

    after login you send only the session ID


    Qt Code:
    1. SoaRequest::SoaRequest( QObject * parent )
    2. : QObject( parent )
    3. {
    4. setObjectName(QString::fromUtf8("SoaRequest"));
    5. Cache(WORK_TICINO_SESSION);
    6. ResetSession();
    7. currentID = -1;
    8. Save_append_Session(); ///// login and start request /////
    9. }
    10.  
    11. void SoaRequest::Login()
    12. {
    13. qDebug() << "### soa Login ACTION ###################";
    14. QString Stream_0 ="PD94bWw.........U+";
    15. QString Stream = fromBase64(Stream_0);
    16. Stream = Stream.replace("_PASS_",decodeBase64(setter.value("tijava/pass").toString()));
    17. Stream = Stream.replace("_USER_",decodeBase64(setter.value("tijava/user").toString()));
    18. ResetSession(); /////// save _SESSION_ or die
    19. Send(Stream,_URLSYSTEM_,1);
    20. }
    21.  
    22. void SoaRequest::Logout()
    23. {
    24. qDebug() << "### soa Logout ACTION ###################";
    25. QString Stream_0 ="PD94bWwgdmVyc2..........lPg==";
    26. QString Stream = fromBase64(Stream_0);
    27. Stream = Stream.replace("_SESSION_",WebSessionCurrent);
    28. qDebug() << "### soa logout -> " << WebSessionCurrent;
    29. Send(Stream,_URLSYSTEM_,0);
    30. ResetSession();
    31. }
    To copy to clipboard, switch view to plain text mode 

    after you write a QNetworkAccessManager login send request and logout
    similar from:
    http://fop-miniscribus.googlecode.co.../remote_cache/

    To debug webservice i write a small debugger:
    http://www.qt-apps.org/content/show....?content=76432


    I try your url and i send on my debugger :

    <?xml version='1.0' encoding='utf-8'?>
    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
    <soap:Header>
    <MessengerHeader xmlns="com.esendex.ems.soapinterface" >
    <Username>bill88</Username>
    <Password>sgsd2352</Password>
    <Account>235235</Account>
    </MessengerHeader>
    </soap:Header>
    <soap:Body>
    <SendMessageFull xmlns="com.esendex.ems.soapinterface" >
    <originator>sxdgsdgssg</originator>
    <recipient>sdfgsdgsd</recipient>
    <body>hello world</body>
    <validityperiod>30</validityperiod>
    </SendMessageFull>
    </soap:Body>
    </soap:Envelope>
    the response:


    ----------------------send request------------------------------------
    ValueName Content-Type = text/xml; charset=utf-8
    ValueName Host = www.esendex.com
    ValueName SOAPAction = com.esendex.ems.soapinterface/SendMessageFull
    ValueName User-Agent = DevNavigator
    ----------------------send end------------------------------------
    ----------------------incomming header----------------------------
    Header responds = 500
    date=Tue, 09 Dec 2008 10:36:21 GMT
    server=Microsoft-IIS/6.0
    x-powered-by=ASP.NET
    x-aspnet-version=2.0.50727
    cache-control=private
    content-type=text/xml; charset=utf-8
    content-length=476


    <?xml version='1.0' encoding='utf-8'?>
    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
    <soap:Body>
    <soap:Fault>
    <faultcode>soap:Client</faultcode>
    <faultstring>Authentication Failed ---> Authentication Failed</faultstring>
    <detail>
    <ErrorCode>2</ErrorCode>
    <ErrorMessage>Authentication Failed</ErrorMessage>
    </detail>
    </soap:Fault>
    </soap:Body>
    </soap:Envelope>


    Also autenfication and message all inside one xml and ommit tipe accept default
    Last edited by patrik08; 9th December 2008 at 10:43.

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

    Default Re: QHttp to Soap Server

    Quote Originally Posted by rohan_m_e View Post
    how can i retrieve it?
    If you are crafting the request structure manually, then you have to manually parse the response and take the xml tag text you need.

Similar Threads

  1. Sql Server cannot retrieve data from select
    By Atomino in forum Qt Programming
    Replies: 10
    Last Post: 7th September 2006, 16:37
  2. QHttp internal error
    By LubosD in forum Qt Programming
    Replies: 1
    Last Post: 16th August 2006, 09:57
  3. how to use QHttp inside QThread in Qt3
    By alusuel in forum Qt Programming
    Replies: 3
    Last Post: 14th July 2006, 11:19
  4. synching client readings to server output
    By OnionRingOfDoom in forum Qt Programming
    Replies: 14
    Last Post: 28th January 2006, 18:15
  5. MultiThreading n Qhttp
    By Shambhavi in forum Qt Programming
    Replies: 1
    Last Post: 18th January 2006, 13:36

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
  •  
Qt is a trademark of The Qt Company.