Back to Dot-Com Builder How-Tos Archive
Overview of WSDL
by James Kao Web Service Description Language (WSDL) is an XML language that contains information about the interface, semantics and "administrivia" of a call to a Web service. Once you have developed a Web service, you publish its description and a link to it in a UDDI (Universal Description, Discovery and Integration) repository so that potential users can find it. When someone thinks they want to use your service, they request your WSDL file in order to find out the location of the service, the function calls and how to access them. Then they use this information in your WSDL file to form a SOAP (Simple Object Access Protocol) request to your computer. The WSDL Standard The WSDL standard is being worked out by the W3C (World Wide Web Consortium). That body further defines the standard as "an XML format for describing network services as a set of endpoints operating on messages containing either document-oriented or procedure-oriented information. The operations and messages are described abstractly, and then bound to a concrete network protocol and message format to define an endpoint. Related concrete endpoints are combined into abstract endpoints (services). WSDL is extensible to allow description of endpoints and their messages regardless of what message formats or network protocols are used to communicate." A Java API for WSDL (JWSDL) A Java API for WSDL (JWSDL) specification is currently in the works in the Java Community Process (JCP). When released, it will provide an API for manipulating WSDL documents without directly interacting with the XML documents. While you can currently achieve the full range of WSDL functionality using JAXP, JWSDL will be much easier and faster to use, simplifying the developer's work. How WSDL Works in the World of Java Technology The following diagram illustrates how a Web service is registered, found and called in a scenario based on Java technology.
A Sample WSDL Definition The WSDL definition shown in the example below contains the following key pieces of information:
<?xml version="1.0"?>
<definitions name="StockQuote"
targetNamespace=
"http://example.com/stockquote.wsdl"
xmlns:tns="http://example.com/stockquote.wsdl"
xmlns:xsd1="http://example.com/stockquote.xsd"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<schema targetNamespace=
http://example.com/stockquote.xsd
xmlns="http://www.w3.org/2000/10/XMLSchema">
<element name="TradePriceRequest">
<complexType>
<all>
<element name="tickerSymbol"
type="string"/>
</all>
</complexType>
</element>
<element name="TradePrice">
<complexType>
<all>
<element name="price" type="float"/>
</all>
</complexType>
</element>
</schema>
</types>
<message name="GetLastTradePriceInput">
<part name="body" element=
"xsd1:TradePriceRequest"/>
</message>
<message name="GetLastTradePriceOutput">
<part name="body" element="xsd1:TradePrice"/>
</message>
<portType name="StockQuotePortType">
<operation name="GetLastTradePrice">
<input message="tns:GetLastTradePriceInput"/>
<output message="tns:GetLastTradePriceOutput"/>
</operation>
</portType>
<binding name="StockQuoteSoapBinding"
type="tns:StockQuotePortType">
<soap:binding style="document"
transport=
"http://schemas.xmlsoap.org/soap/http"/>
<operation name="GetLastTradePrice">
<soap:operation
soapAction=
"http://example.com/GetLastTradePrice"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="StockQuoteService">
<documentation>My first service</documentation>
<port name="StockQuotePort"
binding="tns:StockQuoteBinding">
<soap:address location=
"http://example.com/stockquote"/>
</port>
</service>
</definitions>
|
| |||