/docs/MyDocs

To get this branch, use:
bzr branch http://darksoft.org/webbzr/docs/MyDocs

« back to all changes in this revision

Viewing changes to xml/info/wsdl.txt

  • Committer: Suren A. Chilingaryan
  • Date: 2009-04-09 03:21:08 UTC
  • Revision ID: csa@dside.dyndns.org-20090409032108-w4edamdh4adrgdu3
import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
************************************************************
 
2
********** WSDL (Web Service Description Language) *********
 
3
************************************************************
 
4
 
 
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">
 
9
        ... All other code...
 
10
</definitions>
 
11
 
 
12
wsdl:import
 
13
-----------
 
14
<wsdl:import namespace="uri" location="uri"/>
 
15
 
 
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
 
19
 as needed.
 
20
 
 
21
wsdl:service
 
22
------------
 
23
<wsdl:service name="ServiceName">
 
24
 ... Service Definition ...
 
25
</wsdl:service>
 
26
 
 
27
 Defines Web Service 
 
28
 
 
29
wsdl:port
 
30
---------
 
31
<wsdl:port name="PortName" binding="BindingName">
 
32
  <soap:address location='URL'>
 
33
  <http:address location='URL')
 
34
  ... Operations ....
 
35
</wsdl:port>
 
36
 
 
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.
 
40
 
 
41
wsdl:portType
 
42
-------------
 
43
<wsdl:portType name="PortName" binding="BindingName">
 
44
  <soap:address location='URL'>
 
45
  <http:address location='URL')
 
46
  ... Abstract Operations ...
 
47
</wsdl:portType>
 
48
 
 
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.
 
57
 
 
58
wsdl:message
 
59
------------
 
60
<wsdl:message name="MessageName">
 
61
        <wsdl:part name="parameter1" type="xsd:string"/>
 
62
        <wsdl:part name="parameter2" type="xsd:int"/>
 
63
</wsdl:message>
 
64
 
 
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
 
67
 it described.
 
68
 
 
69
wsdl:operation
 
70
--------------
 
71
<operation name="OperationName" parameterOrder="parameter2 parameter1">
 
72
        <input message="InputMessageName" />
 
73
        <output message="OutputMessageName" />
 
74
        <fault message="FaultMessage" />
 
75
</operation>
 
76
 
 
77
wsdl:documentation
 
78
------------------
 
79
<wsdl:documentation> text </wsdl:documentation>
 
80
 
 
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 
 
84
 language element.
 
85
 
 
86
wsdl:types
 
87
----------
 
88
<wsdl:type>
 
89
        <xsd:schema> xsd schema text </xsd:schema>
 
90
</wsdl:type>
 
91
 
 
92
 Example: 
 
93
    More powerfull way to specify message parts to send
 
94
    <wsdl:types>
 
95
        <schema .... >
 
96
           <element name="MyElement" type="tns:MyType"/>
 
97
           <complexType name="MyType">...</complexType>
 
98
        </schema>
 
99
    </wsdl:types>
 
100
 
 
101
    <message name="PO">
 
102
        <part name="Part1" element="tns:MyElement"/>
 
103
        <part name="Part1" type="tns:MyType"/>
 
104
    </message>
 
105
        
 
106
 
 
107
wsdl:binding
 
108
------------
 
109
<wsdl:binding name="BindingName" type="PortName">
 
110
 
 
111
</wsdl:binding>
 
112
 
 
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
 
116
 
 
117
 Options
 
118
 -------
 
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">
 
123
 
 
124
        <wsdl:operation name="OperationName">
 
125
                <soap:operation soapAction="SOAP Action Header"/>
 
126
                <wsdl:input>
 
127
                        <soap:body      use="encoded|literalz" namespace="URI"
 
128
                                        encodingStle="encoding style"/>
 
129
                        <soap:header    message="MsgName" part="PartName"
 
130
                                        use="literal|encoded" />
 
131
                </wsdl:input>
 
132
                <wsdl:output>
 
133
                        <soap:body .../>
 
134
                </wsdl:output>
 
135
                <wsdl:fault> ... </wsdl:fault>
 
136
        </wsdl:operation
 
137
        
 
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 
 
141
                        specified
 
142
                <soap:opearation>       Specifies 'soapAction' HTTP header to
 
143
                                        send in this operation.
 
144
                                        
 
145
        <wsdl:input>    specifies additional parameters for request message of
 
146
                        specified operation
 
147
        <wsdl:output>   specifies additional parameters for response message of
 
148
                        specified operation
 
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
 
152
 
 
153
 Options Continued
 
154
 -----------------
 
155
        <wsdl:operation name="OperationName">
 
156
          <wsdl:input>
 
157
            <mime:multipartRelated>
 
158
                <mime:part>
 
159
                        <soap:body parts="PartName" use="literal"/>
 
160
                </mime:part>
 
161
                <mime:part>
 
162
                        <mime:content part="PartName1" type="image/gif"/>
 
163
                        <mime:content part="PartName1" type="image/jpeg"/>
 
164
                </mime:part>
 
165
          </wsdl:input>
 
166
        </wsdl:operation>
 
167
 
 
168
        mime:multipartRelated:  Specifies additional options for message 
 
169
                                parts
 
170
        mime:part               Additional options for single part
 
171
        mime:comtent            Specifies possible MIME types for message 
 
172
                                part
 
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 
 
177
                                Envelope.
 
178
        mime:mimeXml            Equvivalent: <mime:content type="text/xml"> 
 
179
                                (i think)
 
180
 
 
181
http:urlReplacement
 
182
-------------------
 
183
<http:urlReplacement/>
 
184
 
 
185
 Indicates that all the message parts are encoded into the HTTP request URI 
 
186
 using a replacement algorithm.
 
187
 
 
188
http:urlEncoded
 
189
---------------
 
190
<http:urlEncoded/>
 
191
 
 
192
 Indicates that all the message parts are encoded into the HTTP request URI 
 
193
 using the standard URI-encoding rules
 
194
 
 
195
Sample Code
 
196
-----------
 
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. 
 
200
 
 
201
TestSoapClient()
 
202
{
 
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);
 
207
        if(pSoapAgent==NULL)
 
208
                return -1;
 
209
 
 
210
        std::string * pOutput;
 
211
        unsigned int nSize=0;
 
212
        HRESULT hr;
 
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
 
220
                )))
 
221
        {
 
222
                // print out results
 
223
                for(int i=0; i<nSize; i++)
 
224
                        _tprintf("%s\n", pOutput[i].c_str());
 
225
        }
 
226
        else
 
227
        {
 
228
                // obtain error string when failed.
 
229
                _tprintf("Error String %s\n", pSoapAgent->GetErrorString());
 
230
        }
 
231
        DestroySoapAgent(pSoapAgent);
 
232
        return 0;
 
233
}
 
234