1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- qtsoap.cpp -->
<head>
<title>QtSoapHttpTransport Class Reference</title>
<link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="57" height="67" border="0" /></td>
<td width="1"> </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a></td>
</tr></table><h1 class="title">QtSoapHttpTransport Class Reference</h1>
<p>The QtSoapHttpTransport class provides a mechanism for transporting SOAP messages to and from other hosts using the HTTP protocol. <a href="#details">More...</a></p>
<pre> #include <QtSoapHttpTransport></pre><p>Inherits <a href="http://qt.nokia.com/doc/4.6/qobject.html">QObject</a>.</p>
<ul>
<li><a href="qtsoaphttptransport-members.html">List of all members, including inherited members</a></li>
<li><a href="qtsoaphttptransport-obsolete.html">Obsolete members</a></li>
</ul>
<hr />
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qtsoaphttptransport.html#QtSoapHttpTransport">QtSoapHttpTransport</a></b> ( QObject * <i>parent</i> = 0 )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qtsoaphttptransport.html#dtor.QtSoapHttpTransport">~QtSoapHttpTransport</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">const QtSoapMessage & </td><td class="memItemRight" valign="bottom"><b><a href="qtsoaphttptransport.html#getResponse">getResponse</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QNetworkAccessManager * </td><td class="memItemRight" valign="bottom"><b><a href="qtsoaphttptransport.html#networkAccessManager">networkAccessManager</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QNetworkReply * </td><td class="memItemRight" valign="bottom"><b><a href="qtsoaphttptransport.html#networkReply">networkReply</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtsoaphttptransport.html#setAction">setAction</a></b> ( const QString & <i>action</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtsoaphttptransport.html#setHost">setHost</a></b> ( const QString & <i>host</i>, bool <i>useSecureHTTP</i> = false, int <i>port</i> = 0 )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtsoaphttptransport.html#submitRequest">submitRequest</a></b> ( QtSoapMessage & <i>request</i>, const QString & <i>path</i> )</td></tr>
</table>
<ul>
<li><div bar="2" class="fn"></div>29 public functions inherited from <a href="http://qt.nokia.com/doc/4.6/qobject.html#public-functions">QObject</a></li>
</ul>
<hr />
<a name="signals"></a>
<h2>Signals</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtsoaphttptransport.html#responseReady">responseReady</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtsoaphttptransport.html#responseReady-2">responseReady</a></b> ( const QtSoapMessage & <i>response</i> )</td></tr>
</table>
<ul>
<li><div bar="2" class="fn"></div>1 signal inherited from <a href="http://qt.nokia.com/doc/4.6/qobject.html#signals">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li><div class="fn"></div>1 property inherited from <a href="http://qt.nokia.com/doc/4.6/qobject.html#properties">QObject</a></li>
<li><div class="fn"></div>1 public slot inherited from <a href="http://qt.nokia.com/doc/4.6/qobject.html#public-slots">QObject</a></li>
<li><div class="fn"></div>1 public type inherited from <a href="http://qt.nokia.com/doc/4.6/qobject.html#public-variables">QObject</a></li>
<li><div class="fn"></div>4 static public members inherited from <a href="http://qt.nokia.com/doc/4.6/qobject.html#static-public-members">QObject</a></li>
<li><div class="fn"></div>7 protected functions inherited from <a href="http://qt.nokia.com/doc/4.6/qobject.html#protected-functions">QObject</a></li>
<li><div class="fn"></div>2 protected variables inherited from <a href="http://qt.nokia.com/doc/4.6/qobject.html#protected-variables">QObject</a></li>
</ul>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The QtSoapHttpTransport class provides a mechanism for transporting SOAP messages to and from other hosts using the HTTP protocol.</p>
<p>Use this class to submit SOAP messages to a web service. Set the hostname of the SOAP server with <a href="qtsoaphttptransport.html#setHost">setHost</a>(). Some servers also require the SOAPAction header to be set, and you can do this with <a href="qtsoaphttptransport.html#setAction">setAction</a>(). Next, submit the request with <a href="qtsoaphttptransport.html#submitRequest">submitRequest</a>(), passing the message to submit together with the path that you want to submit the message to. The <a href="qtsoaphttptransport.html#responseReady">responseReady</a>() signal is emitted when a response has been received. Call <a href="qtsoaphttptransport.html#getResponse">getResponse</a>() to get the reponse from the service.</p>
<p>QtSoapHttpTransport usage example: If a SOAP weather service was running on the host weather.example.com, the following code might be used to find the temperature in any given city:</p>
<pre> void WeatherFetcher::findTemperature(const QString &city)
{
QtSoapMessage message;
message.setMethod("getTemperature", "http:<span class="comment">//weather.example.com/temperature");</span>
message.setMethodArgument("city", "", city);
<span class="comment">// transport is a private member of WeatherFetcher, of type QtSoapHttpTransport</span>
transport.setHost("www.example.com");
connect(&transport, SIGNAL(responseReady()), SLOT(readResponse()));
transport.submitRequest(message, "/weatherfetcher/fetch.asp");
}</pre>
<p>This is an example implementation of the readResponse() slot in the WeatherFetcher class:</p>
<pre> void WeatherFetcher::readResponse()
{
const QtSoapMessage &response = transport.getResponse();
if (response.isFault()) {
cout << response.faultString().toString().toLatin1().constData() << endl;
return;
}
const QtSoapType &returnValue = response.returnValue();
if (returnValue["temperature"].isValid()) {
cout << "The current temperature is "
<< returnValue["temperature"].toString().toLatin1().constData()
<< " degrees Celcius." << endl;
}</pre>
<p>See also <a href="qtsoapmessage.html">QtSoapMessage</a> and <a href="qtsoaptype.html">QtSoapType</a>.</p>
<hr />
<h2>Member Function Documentation</h2>
<h3 class="fn"><a name="QtSoapHttpTransport"></a>QtSoapHttpTransport::QtSoapHttpTransport ( <a href="http://qt.nokia.com/doc/4.6/qobject.html">QObject</a> * <i>parent</i> = 0 )</h3>
<p>Constructs a <a href="qtsoaphttptransport.html">QtSoapHttpTransport</a> object. Passes <i>parent</i> to <a href="http://qt.nokia.com/doc/4.6/qobject.html">QObject</a>'s constructor.</p>
<h3 class="fn"><a name="dtor.QtSoapHttpTransport"></a>QtSoapHttpTransport::~QtSoapHttpTransport ()</h3>
<p>Destructs a <a href="qtsoaphttptransport.html">QtSoapHttpTransport</a>.</p>
<h3 class="fn"><a name="getResponse"></a>const <a href="qtsoapmessage.html">QtSoapMessage</a> & QtSoapHttpTransport::getResponse () const</h3>
<p>Returns the most recently received response SOAP message. This message could be a Fault message, so it is wise to check using <a href="qtsoapmessage.html#isFault">QtSoapMessage::isFault</a>() before processing the response.</p>
<h3 class="fn"><a name="networkAccessManager"></a><a href="http://qt.nokia.com/doc/4.6/qnetworkaccessmanager.html">QNetworkAccessManager</a> * QtSoapHttpTransport::networkAccessManager ()</h3>
<p>Returns a pointer to the <a href="http://qt.nokia.com/doc/4.6/qnetworkaccessmanager.html">QNetworkAccessManager</a> object used by this transport. This is useful if the application needs to connect to its signals, or set or read its cookie jar, etc.</p>
<h3 class="fn"><a name="networkReply"></a><a href="http://qt.nokia.com/doc/4.6/qnetworkreply.html">QNetworkReply</a> * QtSoapHttpTransport::networkReply ()</h3>
<p>Returns a pointer to the <a href="http://qt.nokia.com/doc/4.6/qnetworkreply.html">QNetworkReply</a> object of the current (or last) request, or 0 if no such object is currently available.</p>
<p>This is useful if the application needs to access the raw header data etc.</p>
<h3 class="fn"><a name="responseReady"></a>void QtSoapHttpTransport::responseReady () <tt> [signal]</tt></h3>
<p>This signal is emitted when a SOAP response is received from a remote peer.</p>
<p>See also <a href="qtsoaphttptransport.html#getResponse">getResponse</a>().</p>
<h3 class="fn"><a name="responseReady-2"></a>void QtSoapHttpTransport::responseReady ( const <a href="qtsoapmessage.html">QtSoapMessage</a> & <i>response</i> ) <tt> [signal]</tt></h3>
<p>This signal is emitted when a SOAP response is received from a remote peer. The received response is available in <i>response</i>. This signal is emitted in tandem with the argument-less <a href="qtsoaphttptransport.html#responseReady">responseReady</a>() signal.</p>
<p>See also <a href="qtsoaphttptransport.html#responseReady">responseReady</a>().</p>
<h3 class="fn"><a name="setAction"></a>void QtSoapHttpTransport::setAction ( const <a href="http://qt.nokia.com/doc/4.6/qstring.html">QString</a> & <i>action</i> )</h3>
<p>Sets the HTTP header SOAPAction to <i>action</i>.</p>
<h3 class="fn"><a name="setHost"></a>void QtSoapHttpTransport::setHost ( const <a href="http://qt.nokia.com/doc/4.6/qstring.html">QString</a> & <i>host</i>, bool <i>useSecureHTTP</i> = false, int <i>port</i> = 0 )</h3>
<p>Sets the <i>host</i> this transport should connect to. The transport mode will be HTTP, unless <i>useSecureHTTP</i> is set, in which case it will be HTTPS. This transport will connect to the well-known ports by default (80 for HTTP, 443 for HTTPS), unless a different, non-zero port is specified in <i>port</i>.</p>
<h3 class="fn"><a name="submitRequest"></a>void QtSoapHttpTransport::submitRequest ( <a href="qtsoapmessage.html">QtSoapMessage</a> & <i>request</i>, const <a href="http://qt.nokia.com/doc/4.6/qstring.html">QString</a> & <i>path</i> )</h3>
<p>Submits the SOAP message <i>request</i> to the path <i>path</i> on the HTTP server set using <a href="qtsoaphttptransport.html#setHost">setHost</a>().</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%" align="left">Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies)</td>
<td width="40%" align="center"><a href="http://qt.nokia.com/doc/trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt Solutions</div></td>
</tr></table></div></address></body>
</html>
|