Information Technology Reference
In-Depth Information
This operation takes one parameter symbol of type string that names the
stock of interest and returns a float that holds the most recently traded price.
As this listing shows, a complete WSDL document consists of a set of def-
initions, starting with a root deinition element, followed by six individual
element definitions—types, message, portType, binding, service and port—
which describe a service.
Here is a brief description of the top six elements:
1. types : This element defines the data types contained in messages
exchanged as part of the service. Data types can be simple, complex,
derived, or array types. Types (either schema definitions or refer-
ences) that are referred to in a WSDL document's message element
are defined in the WSDL document's type element.
2. message : This element defines the messages the service exchanges.
A WSDL document has a message element for each message that is
exchanged, and the message element contains the data types associ-
ated with the message. For example, in the Listing 8.2, the first mes-
sage contains a single part that is of the string type.
3. portType : This element specifies, in an abstract manner, operations
and messages that are part of the service. A WSDL document has
one or more portType definitions for each service it defines. In
Listing 8.2, only one port type, StockQuotePortType, is defined.
4. binding : This element binds the abstract port type, and its messages
and operations, to a transport protocol and to a message format. In
Listing 8.2, one operation, GetLastTradePrice, is defined, which has
an input message and an output message. Both of these messages
are exchanged in SOAP body formats. The binding transport proto-
col is HTTP.
5. service : This element together with the port defines the name of an
actual service and, by providing a single address for binding, assigns
an individual endpoint for the service.
6. port : A port can have only one address. The service element groups
related ports together and, through its name attribute, provides a
logical name for the service. In Listing 8.2, one service (stockSer-
vices) is defined that has a single port (or endpoint) with the address
http://mycompany.com/stockServices.
WSDL is well supported by development environments such as Visual
Studio, Eclipse, and WebSphere. These tools can generate WSDL automati-
cally from program method and interface definitions, and they take in
WSDL service definitions and make it easy for developers to write code
that calls these services. One adverse side effect of this tool support is that
it tends to encourage developers to think of services as remote methods,
Search WWH ::




Custom Search