[xhtml]

WSDL, SOAP, and Alphabet Soup

R. Alexander Milowski

milowski at sims.berkeley.edu

#1

Web Services Specifications

#2

The "Useful" Specifications

#3

SOAP in One Slide

#4

Reasons Why to Use SOAP

  1. You want to send "metadata" along with messages.

  2. You need to send routing information.

  3. You want to use the fault mechanisms of SOAP in error responses.

  4. You need to send multiple documents and don't want to use multi-part POST mechanism.

  5. You're doing RPC on the web and so you don't really have a document.

  6. Someone else says you "must" use SOAP.

#5

Thag Must Understand Header

  • The soap:mustUnderstand attribute is a strange beast.

  • When soap:mustUnderstand="true" is present that header element must be understood by the receiving application.

  • Err? What's that mean, boss? Maybe:

    • You reject all messages with header elements that you don't understand where the 'mustUnderstand' attribute is true.

    • You see that there is a mustUnderstand attribute and ignore it. Maybe you understand it and maybe you don't. This is like punting on a test (e.g. answering "7" or "C" when you don't know).

    • You don't look at the mustUnderstand attribute and so you lie and act like you understand it.

    • You reject all messages with mustUnderstand because you can't understand mustUnderstand.

#6

An Example Request

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Body xmlns:t="http://www.smallx.com/services/tideinfo/2005">
<t:tidinfo location="9414290"/>
</soap:Body>
</soap:Envelope>

#7

An Example Response

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Body xmlns:t="http://www.smallx.com/services/tideinfo/2005">
<t:tideinfo today='2005-04-11' high-at='01:18:00-07:00' low-at='07:54:00-07:00' location='9414290' xmlns:t='http://www.smallx.com/services/tideinfo/2005'><t:tide-data><t:tide-level level='5.45' time='00:00:00-07:00' date='2005-04-11'/>
<t:tide-level level='5.52' time='00:06:00-07:00' date='2005-04-11'/>
<t:tide-level level='5.58' time='00:12:00-07:00' date='2005-04-11'/>
<t:tide-level level='5.64' time='00:18:00-07:00' date='2005-04-11'/>
...
</t:tide-data>
</t:tideinfo>
</soap:Body>
</soap:Envelope>

#8

SOAP and Web Services

#9

What is WSDL?

#10

Services, Ports, Bindings, Operations, and Messages, Oh My!

#11

WSDL By Example

#12

The Abstract tideinfo Service

#13

Create an Empty Definition

#14

Import the Schema

#15

Define the Service

#16

Define the Binding

#17

Define the Messages

#18

The Whole Thing...

<wsdl:definitions name="tideinfo"
   xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
   targetNamespace="http://www.smallx.com/services/tideinfo/2005/wsdl"
   xmlns:service="http://www.smallx.com/services/tideinfo/2005/wsdl"
>
   <wsdl:documentation xmlns="http://www.w3.org/1999/xhtml">
   <p>This service provides tide information by NOAA tide monitor location.</p>
   </wsdl:documentation>

<wsdl:import namespace="http://www.smallx.com/services/tideinfo/2005" 
             location="http://www.smallx.com/tideinfo-service/tideinfo.xsd"/>

<wsdl:message name="get-tides">
   <part name="body" element="t:tideinfo"/>
</wsdl:message>

<wsdl:message name="tides">
   <part name="body" element="t:tideinfo"/>
</wsdl:message>

<wsdl:binding name="tideinfo-binding">
   <wsdl:operation name="get-tides">
       <wsdl:input message="service:get-tides"/>
       <wsdl:output message="service:tides"/>
   </wsdl:operation>
</wsdl:binding>

<wsdl:service name="tideinfo">
   <wsdl:port name="tideinfo-port" binding="service:tideinfo-binding"/>
</wsdl:service>

</wsdl:definitions>

#19

Why in the world...

#20

Wash it with SOAP!

Is it really clean?

<wsdl:definitions name="tideinfo"
   xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
   targetNamespace="http://www.smallx.com/services/tideinfo/2005/wsdl"
   xmlns:service="http://www.smallx.com/services/tideinfo/2005/wsdl"
   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>
   <wsdl:documentation xmlns="http://www.w3.org/1999/xhtml">
   <p>This service provides tide information by NOAA tide monitor location.</p>
   </wsdl:documentation>

<wsdl:import namespace="http://www.smallx.com/services/tideinfo/2005" 
             location="http://www.smallx.com/tideinfo-service/tideinfo.xsd"/>

<wsdl:message name="get-tides">
   <part name="body" element="t:tideinfo"/>
</wsdl:message>

<wsdl:message name="tides">
   <part name="body" element="t:tideinfo"/>
</wsdl:message>

<wsdl:binding name="tideinfo-binding">
   <soapbind:binding style="document"
                     transport="http://schemas.xmlsoap.org/soap/http"/>
   <wsdl:operation name="get-tides">
       <wsdl:input message="service:get-tides">
          <soap:body part="body" use="literal"/>
       </wsdl:input>
       <wsdl:output message="service:tides">
          <soap:body part="body" use="literal"/>
       </wsdl:output>
   </wsdl:operation>
</wsdl:binding>

<wsdl:service name="tideinfo">
   <wsdl:port name="tideinfo-port" binding="service:tideinfo-binding">
      <soap:address location="http://www.smallx.com/tideinfo-service/tideinfo.pd"/>
   </wsdl:port>
</wsdl:service>

</wsdl:definitions>