The web service protocols
SOAP
SOAP is...
- the abbreviation for Simple Object Access Protocol
The protocol serves as a distributed object protocol such as RMI or CORBA-IIOP. Thus, whereas RMI is based on the Java platform, and CORBA-IIOP requires the CORBA infrastructure to exchange messages, SOAP is platform and language independent.
- a standard, proposed to the W3C consortium in May 2000 by companies like Ariba, HQ, IBM, Microsoft
- an opportunity to support different transport protocols.
Originally, SOAP was accomplished to transfer messages via http and therefore take advantage of the internet. (Firewalls and proxi servers normally do not block http traffic via port 80) Nevertheless, SOAP can be used with other protocols such as ftp, smtp as well.
A SOAP message is...
- an ordinary XML document, which integrates the SOAP XML Schema by using namespaces.
It consists of three basic elements:
<envelope>: Root, identifies XML documents as a SOAP message
<header>: (optional) infrastructure data
<body>: application data
<?xml version='1.0' encoding='UTF-8'?> <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"> <env:Header /> <env:Body> <reservation xmlns="http://www.taxi.com/TaxiReservation"> <customer> ... </customer> </reservation> </env:Body> </env:Envelope>
WSDL
WSDL stands for Web Service Description Language. As the name already indicates, it is a XML markup language that describes a Web Service. Comparable to the IDL (Interface Definition Language) in CORBA, it can be used for generating web services interfaces, stubs and deployment information.
Just like the advantage of SOAP is its independence of transfer protocols, programming language and platform, WSDL promises to be protocol agnostic. Though wsdl files are normally generated automatically by tools such as AXIS, bugs and deployment problems force developers to understand the different WSDL pieces.
A WSDL document itself comprises the elements described in the following.
<definitions>
This element is the root element. It declares all needed namespaces.
The default namespace is the WSDL Schema. Furthermore, the prefix “soap” is assigned to the SOAP Schema and “xsd” to the XML Schema Language. Therefore, you can integrate SOAP relevant elements and the XML Schema elements (e.g. <complexType> in the wsdl document. Finally the wsdl schema itself needs an identifier, which is declared with the targetNamespace attribute.
<? xml version = '1.0'?> <definitions name = "TaxiAgent" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:titan="http://www.taxi.com/TaxiAgent" targetNamespace="http://www.taxi.com/TaxiAgent" ...
<message>
Definition of parameters and return values.
<message name ="RequestMessage"> <part name="taxiId" type="xsd:int" /> <part name="customerId" type="xsd:int"/> <part name="carId" type="xsd:int"/> <part name="price" type="xsd:double"/> </message> <message name="ResponseMessage"> <part name="reservationId" type="xsd:string" /> </message>
<types>
Allows to declare complex types. Other parts of the WSDL document as well as different WSDL documents can refer to them.
<types> <xsd:schema targetNamespace="http://www.taxi.com/TaxiAgent"> <xsd:complexType name="ReservationType"> <xsd:sequence> <xsd:element name="taxiId" type="xsd:int"/> <xsd:element name="carId" type="xsd:int"/> <xsd:element name="customerId" type="xsd:int"/> <xsd:element name="price" type="xsd:double"/> </xsd:sequence> </xsd:complexType> </xsd:schema> </types>