Can I send a Soap call with QHttp?
I need a example too.
Can I send a Soap call with QHttp?
I need a example too.
Yes. Just format a message according to soap rules and issue a request using QHttp.
But what url I need to use for:
http://www.esendex.com/secure/messen...ndservice.asmx
![]()
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:Originally Posted by xgoan
and everything would be clear...<wsdl:service name="SendService">
<documentation xmlns="http://schemas.xmlsoap.org/wsdl/">Methods to send SMS messages individually and in batches. Click here for a <a href="https://www.esendex.com/uk/evaluation/evaluation.aspx" title="SMS Service Trial">free trial</a>.</documentation>
<wsdl:port name="SendServiceSoap" binding="tns:SendServiceSoap">
<soap:address location="http://www.esendex.com/secure/messenger/soap/sendservice.asmx" />
</wsdl:port>
</wsdl:service>
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
xgoan (14th September 2006)
I have done it and works, here is the code to someone else.
Qt Code:
{ http.setHost(url.host(), url.port(80)); "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"> \n" " <soap:Header>\n" " <MessengerHeader xmlns=\"com.esendex.ems.soapinterface\">\n" " <Username>username</Username>\n" " <Password>password</Password>\n" " <Account>account</Account>\n" " </MessengerHeader>\n" " </soap:Header>\n" " <soap:Body>\n" " <SendMessageFull xmlns=\"com.esendex.ems.soapinterface\">\n" " <originator>dsfs</originator>\n" " <recipient>telefono</recipient>\n" " <body>string</body>\n" " <type>Text</type>\n" " <validityperiod>24</validityperiod>\n" " </SendMessageFull>\n" " </soap:Body>\n" "</soap:Envelope>\n"); cout<<byteArray.data()<<endl; http.setHost(url.host()); header.setValue("Host", "www.esendex.com"); header.setValue("Content-Type", "text/xml; charset=utf-8"); header.setValue("SOAPAction", "com.esendex.ems.soapinterface/SendMessageFull"); http.request(header,byteArray,&file); http.close(); return true; }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
ComaWhite (9th March 2008), sunil.thaha (15th September 2006)
hi,
if u want to retrieve the object from the soap message then how do u do it?
thanks
What do you mean by "the object"? What object?
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.
I suppose you must only one time login && at end logout...
after login you send only the session ID
Qt Code:
{ Cache(WORK_TICINO_SESSION); ResetSession(); currentID = -1; Save_append_Session(); ///// login and start request ///// } void SoaRequest::Login() { qDebug() << "### soa Login ACTION ###################"; Stream = Stream.replace("_PASS_",decodeBase64(setter.value("tijava/pass").toString())); Stream = Stream.replace("_USER_",decodeBase64(setter.value("tijava/user").toString())); ResetSession(); /////// save _SESSION_ or die Send(Stream,_URLSYSTEM_,1); } void SoaRequest::Logout() { qDebug() << "### soa Logout ACTION ###################"; Stream = Stream.replace("_SESSION_",WebSessionCurrent); qDebug() << "### soa logout -> " << WebSessionCurrent; Send(Stream,_URLSYSTEM_,0); ResetSession(); }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 :
the response:<?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>
Also autenfication and message all inside one xml and ommit tipe accept default
----------------------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>
Last edited by patrik08; 9th December 2008 at 10:43.
Bookmarks