Sign In/My Account | View Cart  
advertisement


Listen Print

What's New in WSDL 2.0
by Arulazi Dhesiaseelan | Pages: 1, 2, 3

Stock Quote Service Description in WSDL 1.1 & WSDL 2.0

In this section, you can have a preview of a simple stock quote service which is described using WSDL 1.1 and WSDL 2.0. Listing 2 shows the XML schema types that are used in the describing stock quote service. Listing 3 and 4 shows the stock quote service interface definition in WSDL 1.1 and WSDL 2.0 respectively. Listing 5 and 6 shows the stock quote service implementation definition in WSDL 1.1 and WSDL 2.0 respectively.

http://example.com/stockquote/stockquoteV11.xsd

<?xml version="1.0"?>
<schema targetNamespace="http://example.com/stockquote/schemas"
       
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>

http://example.com/stockquote/stockquoteV20.xsd

<?xml version="1.0"?>
<schema targetNamespace="http://example.com/stockquote/schemas"
       
xmlns="http://www.w3.org/2001/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>

Listing 2: XML Schema definition for Stock Quote Service



http://example.com/stockquote/stockquoteV11.wsdl

<?xml version="1.0"?>
<definitions name="StockQuote"
targetNamespace="http://example.com/stockquote/definitions"
          
xmlns:tns="http://example.com/stockquote/definitions"
          
xmlns:xsd1="http://example.com/stockquote/schemas"
          
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
          
xmlns="http://schemas.xmlsoap.org/wsdl/">
   
<import namespace="http://example.com/stockquote/schemas"
           
location="http://example.com/stockquote/stockquoteV11.xsd"/>
    
<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>
</definitions>

Listing 3: WSDL 1.1 Interface definition for Stock Quote Service



http://example.com/stockquote/stockquoteV20.wsdl

<?xml version="1.0"?>
<definitions name="StockQuote"
targetNamespace="http://example.com/stockquote/definitions"
          
xmlns:tns="http://example.com/stockquote/definitions"
          
xmlns:xsd1="http://example.com/stockquote/schemas"
          
xmlns:soap="http://www.w3.org/2003/11/wsdl/soap12"
          
xmlns="http://www.w3.org/2003/11/wsdl">
   
<import namespace="http://example.com/stockquote/schemas"
           
location="http://example.com/stockquote/stockquoteV20.xsd"/>
   
<types>
                
<schema targetNamespace="http://example.com/stockquote/definitions">
                                
<element name="GetLastTradePriceInput" type="xsd1:TradePriceRequest"/>
                                
<element name="GetLastTradePriceOutput" type="xsd1:TradePrice"/>
                </schema>
   </types>
    
<interface name="StockQuoteInterface">
        
<operation name="GetLastTradePrice" pattern="http://www.w3.org/2003/11/wsdl/in-out">
           
<input message="tns:GetLastTradePriceInput"/>
           
<output message="tns:GetLastTradePriceOutput"/>
        </operation>
    </interface>
</definitions>

Listing 4: WSDL 2.0 Interface definition for Stock Quote Service



http://example.com/stockquote/stockquoteserviceV11.wsdl

<?xml version="1.0"?>
<definitions name="StockQuote"
targetNamespace="http://example.com/stockquote/service"
          
xmlns:tns="http://example.com/stockquote/service"
          
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
          
xmlns:defs="http://example.com/stockquote/definitions"
          
xmlns="http://schemas.xmlsoap.org/wsdl/">
   
<import namespace="http://example.com/stockquote/definitions"
           
location="http://example.com/stockquote/stockquoteV11.wsdl"/>
    
<binding name="StockQuoteSoapBinding" type="defs: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>

Listing 5: WSDL 1.1 Implementation definition for Stock Quote Service



http://example.com/stockquote/stockquoteserviceV20.wsdl

<?xml version="1.0"?>
<definitions name="StockQuote"
targetNamespace="http://example.com/stockquote/service"
          
xmlns:tns="http://example.com/stockquote/service"
          
xmlns:wsoap="http://www.w3.org/2003/11/wsdl/soap12"
          
xmlns:defs="http://example.com/stockquote/definitions"
          
xmlns="http://www.w3.org/2003/11/wsdl">
   
<import namespace="http://example.com/stockquote/definitions"
           
location="http://example.com/stockquote/stockquoteV12.wsdl"/>
    
<binding name="StockQuoteSoapBinding" interface="defs:StockQuoteInterface">
        
<wsoap:binding protocol="http://www.w3.org/2003/11/wsdl/http"/>
        
<operation name="GetLastTradePrice">
           
<wsoap:operation soapAction="http://example.com/GetLastTradePrice"/>
           <input>
               <wsoap:body/>
           </input>
           <output>
               <wsoap:body/>
           </output>
        </operation>
    </binding>
    <service name="StockQuoteService">
        
<documentation>My stock quote service</documentation>
        
<endpoint name="StockQuoteEndPoint" binding="tns:StockQuoteSoapBinding">
           
<wsoap:address location="http://example.com/stockquote"/>
        </endpoint>
    </service>
</definitions>

Listing 6: WSDL 2.0 Implementation definition for Stock Quote Service

Summary

In this article I have explained some details of the working draft WSDL 2.0 specifications. Discussions are happening in this working group for adding more features to the existing specification in order to provide a highly flexible and robust language for describing web services. Some of the features include web service references, versioning, attributes, and compositors. In addition to these new features, further refinements are made to the existing specification. The developer community is anticipating a more stable version of WSDL 2.0 specification in the near future.