Simple Object Access Protocol
Contract First
Contract Last
<SOAP-ENV:Header>
<t:Transaction xmlns:t="some-URI" SOAP-ENV:mustUnderstand="1">
5
</t:Transaction>
</SOAP-ENV:Header>
Types primitifs
<element name="price" type="float"/>
<element name="greeting" type="xsd:string"/>
<price>15.57</price>
<greeting id="id1">Hello</greeting>
<element name="Book">
<complexType>
<element name="author" type="xsd:string"/>
<element name="title" type="xsd:string"/>
</complexType>
</element>
<e:Book>
<author>J.R.R Tolkien</author>
<title>A hobbit story</title>
</e:Book>
Structures
Enumérations
<element name="color">
<simpleType base="xsd:string">
<enumeration value="Green"/>
<enumeration value="Blue"/>
</simpleType>
</element>
<color>Blue</color>
<e:Book id="id1">
<title>My Life and Work</title>
<firstauthor href="#Person-1"/>
</e:Book>
<e:Person id="Person-1">
<name>Henry Ford</name>
<address xsi:type="m:Electronic-address">
</e:Person>
Référence
<element name="Person" base="tns:Person"/>
<complexType name="Person">
<sequence minOccurs="0" maxOccurs="1">
<element name="name" type="xsd:string"/>
<element name="address" type="tns:Address"/>
</sequence>
<attribute name="href" type="uriReference"/>
<attribute name="id" type="ID"/>
<anyAttribute namespace="##other"/>
</complexType>
<soap:Envelope xmlns:soap='uri for soap'>
<soap:Body>
<calculateArea xmlns='interfaceURI'>
<origin><x>23</x><y>34</y></origin>
<corner><x>23</x><y>34</y></corner>
</calculateArea>
</soap:Body>
</soap:Envelope>
MustUnderstand
HTTP/1.1 500 Internal Server Error
Content-Type: text/xml; charset="utf-8"
Content-Length: nnnn
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:MustUnderstand</faultcode>
<faultstring>SOAP Must Understand Error</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Erreur sur le corps
HTTP/1.1 500 Internal Server Error
Content-Type: text/xml; charset="utf-8"
Content-Length: nnnn
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring>Server Error</faultstring>
<detail>
<e:myfaultdetails xmlns:e="Some-URI">
<message> My application didn't work </message>
<errorcode>1001</errorcode>
</e:myfaultdetails>
</detail>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
<soap:Envelope xmlns:soap=‘uri for soap’>
<soap:Body>
<Add xmlns=‘interfaceURI’>
<arg1>24</arg1>
<arg2>53.2</arg2>
</Add>
</soap:Body>
</soap:Envelope>
<soap:Envelope xmlns:soap=‘uri for soap’>
<soap:Body>
<AddResponse xmlns=‘interfaceURI’>
<sum>77.2</sum>
</AddResponse>
</soap:Body>
</soap:Envelope>
Requête
Réponse
Web Service Description Language
Contient les définition de types utilisant un système de typage
<types>
<xsd:schema targetNamespace="urn:xml-soap-address-demo"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<xsd:complexType name="phone">
<xsd:element name="areaCode" type="xsd:int"/>
<xsd:element name="exchange" type="xsd:string"/>
<xsd:element name="number" type="xsd:string"/>
</xsd:complexType>
<xsd:complexType name="address">
<xsd:element name="streetNum" type="xsd:int"/>
<xsd:element name="streetName" type="xsd:string"/>
<xsd:element name="city" type="xsd:string"/>
<xsd:element name="state" type="xsd:string"/>
<xsd:element name="zip" type="xsd:int"/>
<xsd:element name="phoneNumber" type="typens:phone"/>
</xsd:complexType>
</xsd:schema>
</types>
Décrit les noms et types d’un ensemble de champs à transmettre
<message name="AddEntryRequest">
<part name="name" type="xsd:string"/>
<part name="address" type="typens:address"/>
</message>
<message name="GetAddressFromNameRequest">
<part name="name" type="xsd:string"/>
</message>
<message name="GetAddressFromNameResponse">
<part name="address" type="typens:address"/>
</message>
Plusieurs types d’opérations
Plusieurs types d’opérations
<portType name="AddressBook">
<!– One way operation -->
<operation name="addEntry">
<input message="AddEntryRequest"/>
</operation>
<!– Request-Response operation -->
<operation name="getAddressFromName">
<input message="GetAddressFromNameRequest"/>
<output message="GetAddressFromNameResponse"/>
</operation>
</portType>
<binding name="AddressBookSOAPBinding" type="AddressBook">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="addEntry">
<soap:operation soapAction=""/>
<input>
<soap:body use="encoded" namespace="urn:AddressFetcher2"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:AddressFetcher2"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="getAddressFromName">
<soap:operation soapAction=""/>
<input>
<soap:body use="encoded" namespace="urn:AddressFetcher2"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:AddressFetcher2"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
Spécifie une liaison d’un <porttype> à un protocole concret
<?xml version="1.0" ?>
<definitions name="urn:AddressFetcher"
targetNamespace="urn:AddressFetcher2"
xmlns:typens="urn:xml-soap-address-demo"
xmlns:xsd="http://www.w3.org/1999/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
...
<!-- service decln -->
<service name="AddressBookService">
<port name="AddressBook" binding="AddressBookSOAPBinding">
<soap:address location="http://www.mycomp.com/soap/servlet/rpcrouter"/>
</port>
</service>
</definitions>
Une collection de points d’entrée (endpoint) relatifs
Universal Description, Discovery and Integration
Sert à décrire une manière standard de publier et d'interroger les services web proposés par un réseau
Permettre de localiser sur le réseau le service Web recherché