1
************************************************************
2
********** WSDL (Web Service Description Language) *********
3
************************************************************
5
<wsdl:definitions name='wsdl name'
6
xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'
7
xmlns:mime='http://schemas.xmlsoap.org/wsdl/mime/'
8
targetNamespace="something">
14
<wsdl:import namespace="uri" location="uri"/>
16
Include specified in 'location' document into specified namespace.
17
The use of the import element allows the separation of the different elements
18
of a service definition into independent documents, which can then be imported
23
<wsdl:service name="ServiceName">
24
... Service Definition ...
31
<wsdl:port name="PortName" binding="BindingName">
32
<soap:address location='URL'>
33
<http:address location='URL')
37
* Each Web Service can have several ports
38
* soap:address specifies ports which based on SOAP transfer protocol
39
and http:address are based on HTTP transfer protocol.
43
<wsdl:portType name="PortName" binding="BindingName">
44
<soap:address location='URL'>
45
<http:address location='URL')
46
... Abstract Operations ...
49
Message definitions are always considered to be an abstract definition of the
50
message content. A message binding describes how the abstract content is
51
mapped into a concrete format. However, in some cases, the abstract definition
52
may match the concrete representation very closely or exactly for one or more
53
bindings, so those binding(s) will supply little or no mapping information.
54
However, another binding of the same message definition may require extensive
55
mapping information. For this reason, it is not until the binding is inspected
56
that one can determine "how abstract" the message really is.
60
<wsdl:message name="MessageName">
61
<wsdl:part name="parameter1" type="xsd:string"/>
62
<wsdl:part name="parameter2" type="xsd:int"/>
65
Specifies posible messages and it's parameters (or return values in respond
66
messages). All 'part' elements must have some name with data parameter
71
<operation name="OperationName" parameterOrder="parameter2 parameter1">
72
<input message="InputMessageName" />
73
<output message="OutputMessageName" />
74
<fault message="FaultMessage" />
79
<wsdl:documentation> text </wsdl:documentation>
81
WSDL uses the optional wsdl:document element as a container for human readable
82
documentation. The content of the element is arbitrary text and elements
83
("mixed" in XSD). The documentation element is allowed inside any WSDL
89
<xsd:schema> xsd schema text </xsd:schema>
93
More powerfull way to specify message parts to send
96
<element name="MyElement" type="tns:MyType"/>
97
<complexType name="MyType">...</complexType>
102
<part name="Part1" element="tns:MyElement"/>
103
<part name="Part1" type="tns:MyType"/>
109
<wsdl:binding name="BindingName" type="PortName">
113
Specifies additional port parameters (i.e. SOAP Transport, soapAction HTTP
114
header to be used (see SOAP))
115
* 'port' and 'binding' must reference each other
119
<soap:binding style="rpc|document"
120
transport='http://schemas.xmlsoap.org/soap/http' /> |or
121
transport='http://schemas.xmlsoap.org/soap/smtp' /> |or
122
<http:binding verb="POST|GET">
124
<wsdl:operation name="OperationName">
125
<soap:operation soapAction="SOAP Action Header"/>
127
<soap:body use="encoded|literalz" namespace="URI"
128
encodingStle="encoding style"/>
129
<soap:header message="MsgName" part="PartName"
130
use="literal|encoded" />
135
<wsdl:fault> ... </wsdl:fault>
138
<soap:binding> specifies transoprt for SOAP ports (i.e HTTP, SMTP, etc)
139
<http:binding> specifies HTTP method for HTTP ports (GET | POST)
140
<wsdl:operation>specifies additional transport options for operation
142
<soap:opearation> Specifies 'soapAction' HTTP header to
143
send in this operation.
145
<wsdl:input> specifies additional parameters for request message of
147
<wsdl:output> specifies additional parameters for response message of
149
<wsdl:fault> for fault message
150
<soap:body> Specifies options(encodingStyle, etc) for SOAP:BODY
151
<soap:header> Specifies message to send as header
155
<wsdl:operation name="OperationName">
157
<mime:multipartRelated>
159
<soap:body parts="PartName" use="literal"/>
162
<mime:content part="PartName1" type="image/gif"/>
163
<mime:content part="PartName1" type="image/jpeg"/>
168
mime:multipartRelated: Specifies additional options for message
170
mime:part Additional options for single part
171
mime:comtent Specifies possible MIME types for message
173
soap:body When using the MIME binding with SOAP requests,
174
it is legal to use the soap:body element as a
175
MIME element. It indicates the content type is
176
"text/xml", and there is an enclosing SOAP
178
mime:mimeXml Equvivalent: <mime:content type="text/xml">
183
<http:urlReplacement/>
185
Indicates that all the message parts are encoded into the HTTP request URI
186
using a replacement algorithm.
192
Indicates that all the message parts are encoded into the HTTP request URI
193
using the standard URI-encoding rules
197
The sample demonstrates how to write a SOAP client application using SQLData
198
SOAP Client library. It accesses the web service at http://www.soapclient.com
199
and calls Method1 to get an echo of the two input parameters.
203
// initialize the parameter array for the method call. The array must end with NULL.
204
TCHAR* pParams[3]={"My First Param", "My Second Param", NULL};
205
// create an soapagent in debug mode (mode=4)
206
SoapAgent *pSoapAgent= MakeSoapAgent(NULL, NULL, 4);
210
std::string * pOutput;
211
unsigned int nSize=0;
213
// invoke the remote method
214
if(SUCCEEDED(hr=pSoapAgent->ExecuteMethod(
215
"http://www.soapclient.com/xml/soapresponder.wsdl", // WSDL file
216
"Method1", // method name to be invoked.
217
pParams, // array of input parameters.
218
&pOutput, // array of output parameters
219
&nSize // number of output variable in pOutput
223
for(int i=0; i<nSize; i++)
224
_tprintf("%s\n", pOutput[i].c_str());
228
// obtain error string when failed.
229
_tprintf("Error String %s\n", pSoapAgent->GetErrorString());
231
DestroySoapAgent(pSoapAgent);