< previous
index

WSDL: about SOAP

next >

The third file defines the SOAP activities. (Filename in $service). Usually, the portType is defined in the name-space, but as this example shows, that is not required. Also, often the message content (as shown on the first page) is included in the same name-space and file.

   <?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/stockquote.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:StockQuoteSoapBinding">
         <soap:address location="http://example.com/stockquote"/>
       </port>
     </service>
   </definitions>

The binding connects the externally visible service name to the portType. As you can see, this is a document soap interaction: well defined. `Literal' means un-encoded: especially in XML-RPC, program data structures are automatically encapsulated via some encoding mechanism.


YAPC::EU 2007 Vienna, Presentation of XML::Compile second part, by Mark Overmeer.