Slideshow

Web Services - the good, the bad and the (extremely) ugly
Jan Newmarch
Monash University, Australia


Web services


Web service components


Advanced WS Protocol Stack

From The Web Services Protocol Stack

Web service supporters

WSDL


Service example


WSDL version of example


<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
    xmlns:xsd="http://www.w3.org/2000/10/XMLSchema"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:tns="urn:Converter" targetNamespace="urn:Converter" name="ConverterService">
    <message name="inchToMMRequest">
        <part name="param1" type="xsd:float"/>
    </message>
    <message name="inchToMMResponse">
        <part name="return" type="xsd:float"/>
    </message>
    <message name="mmToInchRequest">
        <part name="param1" type="xsd:float"/>
    </message>
    <message name="mmToInchResponse">
        <part name="return" type="xsd:float"/>
    </message>
    <message name="java_rmi_RemoteException">
        <part type="xsd:string" name="java_rmi_RemoteException"/>
    </message>
    <message name="com_iona_xmlbus_webservices_ejbserver_ConversionException"
>
        <part type="xsd:string" name="com_iona_xmlbus_webservices_ejbserver_ConversionException"/&
gt;
    </message>
    <portType name="ConverterPortType">
        <operation name="inchToMM">
            <input message="tns:inchToMMRequest" name="inchToMM"/>
            <output message="tns:inchToMMResponse" name="inchToMMResponse"/>
            <fault message="tns:java_rmi_RemoteException" name="java_rmi_RemoteException"/>
        </operation>
        <operation name="mmToInch">
            <input message="tns:mmToInchRequest" name="mmToInch"/>
            <output message="tns:mmToInchResponse" name="mmToInchResponse"/>
            <fault message="tns:java_rmi_RemoteException" name="java_rmi_RemoteException"/>
            <fault
                message="tns:com_iona_xmlbus_webservices_ejbserver_ConversionException"
                   name="com_iona_xmlbus_webservices_ejbserver_ConversionException"/>
        </operation>
    </portType>
    <binding name="ConverterBinding" type="tns:ConverterPortType">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http/" style="rpc"/>
        <operation name="inchToMM">
            <soap:operation soapAction="" style="rpc"/>
            <input name="inchToMM">
                <soap:body use="encoded" namespace="urn:Converter"
                     encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </input>
            <output name="inchToMMResponse">
                <soap:body use="encoded" namespace="urn:Converter"
                     encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </output>
            <fault name="java_rmi_RemoteException">
                <soap:fault name="java_rmi_RemoteException"
                    use="encoded" namespace="urn:Converter"
                       encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
           </fault>
        </operation>
        <operation name="mmToInch">
            <soap:operation soapAction="" style="rpc"/>
            <input name="mmToInch">
                <soap:body use="encoded" namespace="urn:Converter"
                     encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </input>
            <output name="mmToInchResponse">
                <soap:body use="encoded" namespace="urn:Converter"
                     encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </output>
            <fault name="java_rmi_RemoteException">
                <soap:fault name="java_rmi_RemoteException"
                    use="encoded" namespace="urn:Converter"
                        encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </fault>
            <fault name="com_iona_xmlbus_webservices_ejbserver_ConversionException">
                <soap:fault
                    name="com_iona_xmlbus_webservices_ejbserver_ConversionException"
                    use="encoded" namespace="urn:Converter"
                         encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </fault>
        </operation>
    </binding>
    <service name="Converter">
        <port name="ConverterPort" binding="tns:ConverterBinding">
            <soap:address location="http://www.xmlbus.com:9010/ionasoap/servlet/Converter"/>
        </port>
    </service>
</definitions>


WSDL structure

A WSDL document has the structure


Critique of WSDL


Implications and recommendations


SOAP


REST

SOAP vs REST

SOAP:


POST url HTTP/1.1
HOST: ...
CONTENT-LENGTH: ...
CONTENT-TYPE: ...
SOAP-ACTION: ...

<Envelope>
  <Body>
    <CUSTOMERS>
    </CUSTOMERS>
  </Body>
</Envelope>
with response

HTTP/1.0 200
CONTENT-TYPE: text/xml
CONTENT-LENGTH: ..
<?xml version="1.0"?>
<Envelope>
  <Body>
    <CUSTOMERS>
      <CUSTOMER>
        <ID>11</ID>
        <FIRSTNAME>Julia</FIRSTNAME>
        ...
      </CUSTOMER>
      ...
    </CUSTOMERS>
  </Body>
</Envelope>

REST:


GET http://host/CUSTOMERS
with response

<resources xmlns:xlink="http://www.w3.org/1999/xlink">
  <resource xlink:href="http://host/CUSTOMER/0/">0 </resource>
  <resource xlink:href="http://host/CUSTOMER/1/">1 </resource>
  <resource xlink:href="http://host/CUSTOMER/2/">2 </resource>
  <resource xlink:href="http://host/CUSTOMER/3/">3 </resource>
</resources>


Efficiency

Experiments conducted in a UPnP system, replacing SOAP with REST:

SOAP/Xerces Soap/KXML REST
standalone 196 137 67
network 165 114 64

Time to make 1000 queries (secs)

SOAP REST
Request payload 350 4
packet 535 84
Response payload 365 11
packet 526 171

Query request size (bytes)

SOAP/Xerces Soap/KXML REST
classes+data 416,336 114,808 6,072

Size of parsers (bytes)

SOAP accomodating REST

Web services now claim to have resolved any issues about using REST, so that it is a "dead" issue From SOAP 1.2. section 6.4 "SOAP Web Method Feature":

Underlying protocols designed for use on the World Wide Web provide for manipulation of resources using a small set of Web methods such as GET, PUT, POST, and DELETE. These methods are formally defined in the HTTP specification [RFC 2616], but other underlying protocols might also support them. Bindings to HTTP or such other protocols SHOULD use the SOAP Web Method feature to give applications control over the Web methods to be used when sending a SOAP message. Bindings supporting this feature SHOULD use the appropriate embodiment of that method if provided by the underlying protocol; for example, the HTTP binding provided with this specification represents the "GET" Web method as an HTTP GET request, and the "POST" method as an HTTP POST request (see 7. SOAP HTTP Binding). Bindings supporting this feature SHOULD provide to the receiving node indication of the Web method used for transmission. The SOAP Web Method feature MAY be implemented by bindings to underlying transports that have no preferred embodiment of particular Web methods (e.g. do not distinguish GET from POST). Such bindings SHOULD provide to the receiving node indication of the Web method used for transmission, but need take no other action in support of the feature.


Implications and recommendations


UDDI


Implications and recommendations


Session management


Implications and recommendations


Firewalls


Security


Implications and recommendations


Conclusion


Jan Newmarch (http://jan.newmarch.name)
jan@newmarch.name
Last modified: Wed Jul 6 10:19:47 EST 2005
Copyright ©Jan Newmarch