Main Page

WSDL

The SOAP message itself is contained inside an
envelope
, which is used to transfer the Web service call to
and from the server. A typical SOAP message looks like this:
<soap:Envelope xmlns:n=”custom namespace goes here”
xmlns:soap=”http://schemas.xmlsoap.org/soap/envelope/”
xmlns:soapenc=”http://schemas.xmlsoap.org/soap/encoding/”
xmlns:xs=”http://www.w3.org/2001/XMLSchema”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”>
<soap:Body soap:encodingStyle=”http://schemas.xmlsoap.org/soap/encoding/”>
<!-- method-specific XML goes here -->
</soap:Body>
</soap:Envelope>
In the case of the client sending the message, the XML in
<soap:Body/>
includes a method to call and
parameters. When the server sends the message,
<soap:Body/>
includes the result(s) of the call. The
result can be a single value or a complex data type with multiple values.
Naturally, it is important that the client sends the SOAP message in the correct format, but how does a
developer know how to format the message? This is where WSDL comes in.
WSDL
Web Services Description Language (WSDL, pronounced wizdel) is used to describe the capabilities, for-
mat, and other important information about Web services. WSDL files define the various operations a
Web service provides.
Operations
are specific remote functions that can be called for a given service (a Web
service can have one or more operations). It helps to think of a Web service as an object with one or more
methods; the object itself represents the service whereas the operations are considered the methods.
The basic sections of a WSDL file are the following:
?
Types — Defines the types used for the Web service calls. These types are based on XML
Schema data types and can represent simple types — such as numbers or strings — or complex
types, similar to objects that have properties.
?
Messages — Defines the input arguments and the output value for a given operation. Each
operation gets two message definitions, one for the operation request and one for the response.
?
Port Type — Defines the operations that are available from the Web service.
?
Bindings — Defines the format of the messages sent and received with each operation.
?
Service — Defines how to access the Web service operations.
A standard WSDL file has the following format:
<definitions name=”name_of_service”
targetNamespace=”target_namespace”
xmlns:tns=”location_of_wsdl”
xmlns:xsd=”http://www.w3.org/2001/XMLSchema”
xmlns:soap=”http://schemas.xmlsoap.org/wsdl/soap/”
510
Chapter 17
20_579088 ch17.qxd 3/28/05 11:42 AM Page 510


JavaScript EditorFree JavaScript Editor     Ajax Editor


©