wsdl web services definition language von nikos vormwald

38
WSDL Web Services Definition Language Von Nikos Vormwald

Upload: norbert-hummel

Post on 06-Apr-2016

223 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: WSDL Web Services Definition Language Von Nikos Vormwald

WSDLWeb Services Definition Language

Von Nikos Vormwald

Page 2: WSDL Web Services Definition Language Von Nikos Vormwald

Übersicht● Einleitung (3-4)

● Geschichte von WSDL (5-6)● Warum WSDL? (7)

● WSDL Syntax (8)● Übersicht (9-10)● Elemente (11-16)

● Transmission Primitives (17)● Protokoll Bindungen (18)

● SOAP (19-27)● HTTP GET/POST (28-33)● MIME (34-35)

● WSDL-Erstellung mit Tool (36-37)

Page 3: WSDL Web Services Definition Language Von Nikos Vormwald

WSDL – Einleitung● Was ist WSDL?

● Sprache zur Definition von Web Services● Was sind Web Services?

● Alles, was mit WSDL darstellbar ist● Ein spezieller Web Service in WSDL-Datei beschrieben● Web Service vorstellbar als Funktion:

● Eingabe = Parameter; Ausgabe = Rückgabewert● Kommunikation über Internet

● Bsp.: Temperaturauskunft Web Service● Eingabe: Ort; Ausgabe: Temperatur

Page 4: WSDL Web Services Definition Language Von Nikos Vormwald

WSDL – Einleitung● Was ist WSDL nicht?

● WSDL ist keine Implementierung!● Nur Beschreibung/Informationsdatei über Web Services

● Was wird mit WSDL beschrieben?● Was ich an Web Service senden muss

● Im Bsp.: Ort (als GPS-Koordinaten? Längengrad? Stadtname? Postleitzahl?)● Was ich vom Web Service zurück bekomme

● Im Bsp.: Temperatur (Celcius? Kelvin? Fahrenheit?)● Womit ich senden muss

● Welches Protokoll (SOAP? HTTP GET/POST? MIME?)

Page 5: WSDL Web Services Definition Language Von Nikos Vormwald

WSDL – Geschichte● Vorher: SOAP

● Protokoll zur Übertragung von Nachrichten● Problem: Keine Beschreibung wie Nachrichten aussehen müssen

● „Lösungen“:● IBM: NASSL (Network Accessibility Service Specification Language)

● Struktur: XML; Datentypen: XSD● Microsoft: SCL (Services Contract Language) (Frühling 2000)

● Struktur: XML; Datentypen: XDR (XML Data Reduced)

● Probleme● Beide Beschreibungen nur für ein Protokoll (SOAP)● Beide Beschreibungen inkompatibel

Page 6: WSDL Web Services Definition Language Von Nikos Vormwald

WSDL – Geschichte● Lösung: WSDL

● Von IBM, Microsoft und Ariba● WSDL 1.1 - März 2001● Struktur: XML; Datentypen: XSD

Page 7: WSDL Web Services Definition Language Von Nikos Vormwald

Warum WSDL?● Web Services müssen sich selbst beschreiben

● Millionen Unabhängige Komponenten im Internet verfügbar● Von jeder Plattform aus nutzbar● In jeder Entwicklungssprache geschrieben

● WSDL zur Beschreibung nutzen● Web Service ist für Client nutzbar, ohne

● Wissen über die Implementierung des Web Service● Wissen über die Plattform oder Betriebssystem des Web Service

● Verwendung offener Standards● XML, XSD, SOAP, MIME● Kann jeder Web Service unabhängig von Plattform und Implementierung

Page 8: WSDL Web Services Definition Language Von Nikos Vormwald

WSDL Syntax● Grundlagen:

● Endpunkte (Ports) die Nachrichten austauschen● Unterscheidung zwischen

● abstrakter Definition einer Nachricht ● konkretem Weg, wie die Nachricht auf ein Protokoll abgebildet wird

● Warum WSDL Syntax lernen?● In der Praxis wird WSDL Dokument von Tools erstellt● Aber: Für Feinanpassungen Kenntnisse erforderlich

Page 9: WSDL Web Services Definition Language Von Nikos Vormwald

WSDL SyntaxElementenübersicht

● Types <types>● Messages <message>● Operations <operation>● Port types <portType>● Bindings <binding>● Ports <port>● Services <service>

Page 10: WSDL Web Services Definition Language Von Nikos Vormwald

Porttyp-Operation-Message-TypStruktur

Message Message Message

Operation

Typ Typ Typ Typ

Operation

Porttyp

Page 11: WSDL Web Services Definition Language Von Nikos Vormwald

Das Element<types>

<types><schema targetNamespace=“http://example.com/currenttemp.xsd“

xmlns=“http://www.w3.org/2000/10/XMLSchema“><element name=“CurrentTemperatureRequest“>

<complexType><all>

<element name=“cityCode“ type=“string“/>

</all></complexType>

</element><element name=“CurrentTemperature“>

<complexType><all>

<element name=“temp“ type=“float“/>

</all></complexType>

</element></schema>

</types>

Page 12: WSDL Web Services Definition Language Von Nikos Vormwald

Das Element<message>

<message name=“InputMessage“><part name=“body“ element=“xsd1:CurrentTemperatureRequest“>

</message><message name=“OutputMessage“>

<part name=“body“ element=“xsd1:CurrentTemperature“></message>

● Besteht aus Teilen (Parts)● Jeder Part ist ein Typ/Element

● Bei Message mit mehr als einem Typ: 2 Möglichkeiten● Message mit 2 Teilen; jeder Teil ein Typ● Dritten Typ definieren (Typ1 und Typ2) und Message mit einem Teil

Page 13: WSDL Web Services Definition Language Von Nikos Vormwald

Die Elemente<portTyp> und <operation>

<portType name=“CurrentTemperaturePortType“><operation name=“GetCurrentTemperature“>

<input name=“Input“ message=“InputMessage“><output name=“Output“ message=“OutputMessage“><fault name=“Fault“ message=“FaultMessage“>

</operation></portType>

● Operation ~ Funktion mit Eingabe, Ausgabe, Ausnahmen● Porttyp mit mehreren Operationen

Page 14: WSDL Web Services Definition Language Von Nikos Vormwald

Service-Port-Binding-PorttypStruktur

Porttyp

Binding Binding

Port Port

Service

Page 15: WSDL Web Services Definition Language Von Nikos Vormwald

Das Element<binding>

● Definiert, wie eine Operation an ein Protokoll gebunden wird

<binding name=“CurrentTemperatureSoapBinding“type=“CurrentTemperaturePortType“>

<soap:binding style=“document“transport=“http://schemas.cmlsoap.org/soap/http“/>

<operation name=“GetCurrentTemperature“><soap:operation

soapOperation=“http://example.com/GetCurrentTemperature“/>

<input><soap:body use=“literal“/>

</input><output>

<soap:body use=“literal“/></output>

</operation></binding>

Page 16: WSDL Web Services Definition Language Von Nikos Vormwald

Die Elemente<port> und <service>

● Ein port verknüpft ein binding mit protokollspezifischer Adresse

● Ein service kann mehrere ports beinhalten, also auf mehreren Protokollen laufen

● z.Bsp.: PC mit SOAP; WAP-Handy mit HTTP GET/POST

<service name=“CurrentTemperatureService“><port name=“CurrentTemperaturePort“

binding=“CurrentTemperatureSoapBinding“><soap:adress

location=“http://example.com/currenttemp“/></port>

</service>

Page 17: WSDL Web Services Definition Language Von Nikos Vormwald

Transmission Primitives● Welche und wieviele Nachrichten eine Operation hat:

● One-way Operation (~Prozedur ohne Rückgabewert)● Input (z. Bsp.: Bestellung)

● Request/Response Operation (~Funktion Parameter->Rückgabe)● Input (Stadtcode)● Output (Temperatur)● [Fault]

● Solicit/Response Operation (keine Bindung vorhanden)● Output (Bestellungsstatus)● Input (Bestätigung)● [Fault]

● Notification Operation (keine Bindung vorhanden)● Output (periodischer Statusreport)

Page 18: WSDL Web Services Definition Language Von Nikos Vormwald

Protokoll Bindungen● SAOP

● soap:binding● soap:operation● soap:body● soap:fault● SMTP Beispiel

● HTTP GET/POST● MIME

● mime:multipartRelated● mime:content● mime:mimeXml

Page 19: WSDL Web Services Definition Language Von Nikos Vormwald

soap:binding● Weißt darauf hin, dass an SOAP gebunden werden soll● Gibt an was genutzt werden soll:

● Transport Mechanismus (HTTP, SMTP, FTP) (benötigt)● Encoding style (rpc,document) (Optional; Standard:document)

<binding...><soap:binding style=“rpc | document“ transport=“uri“/><operation...></operation>

</binding>

Page 20: WSDL Web Services Definition Language Von Nikos Vormwald

soap:operation● Gibt an, wie eine Operation an SOAP gebunden wird● Enthält:

● SOAPAction Header (benötigt bei HTTP-Transport)● Encoding style (rpc,document) (Optional; zum Überschreiben)

<binding...><operation...>

<soap:operation soapAction=“uri“ style=“rpc | document“/>

</operation></binding>

Page 21: WSDL Web Services Definition Language Von Nikos Vormwald

soap:body● Enthält:

● parts gibt an welche Teile der Nachricht in den SOAP-Body eingefügt werden (optional; Standard: Alle)

● Use, namespace und encodingStyle geben an wie die Teile in den SOAP Body eingefügt werden.

<binding...><operation...>

<input...><soap:body parts=“nmtokens“ use=“encoded |

literal“ namespace=“uri“ encodingStyle=“uri“/>

</input></operation>

</binding>

Page 22: WSDL Web Services Definition Language Von Nikos Vormwald

Beispielwerte und zugehörige SOAP Nachrichten

● Beispielwerte:● Für style (in soap:binding): document● Für use (in soap:body): literal

<binding...><soap:binding

style=“document“><operation...>

<soap:operation...><input...>

<soap:body use=“literal“/>

</input></operation>

</binding>

<soapenv:Envelope...><soapenv:Body>

<cityCode>PDX</cityCode>

</soapenv:Body></soapenv:Envelope>

Page 23: WSDL Web Services Definition Language Von Nikos Vormwald

Beispielwerte und zugehörige SOAP Nachrichten

● Beispielwerte:● Für style (in soap:binding): rpc● Für use (in soap:body): literal

● => Name der Operation eingefügt

<binding...><soap:binding style=“rpc“><operation...>

<soap:operation...><input...>

<soap:body use=“literal“/>

</input></operation>

</binding>

<soapenv:Envelope...><soapenv:Body>

<GetCurrentTemperature><cityCode>PDX</

cityCode></GetCurrentTemperature>

</soapenv:Body></soapenv:Envelope>

Page 24: WSDL Web Services Definition Language Von Nikos Vormwald

Beispielwerte und zugehörige SOAP Nachrichten

● Beispielwerte:● Für style (in soap:binding): rpc● Für use (in soap:body): encoded

● => encodingStyle wird zur Abbildung auf SOAP Body benutzt<binding...>

<soap:binding style=“rpc“><operation...>

<soap:operation...><input...>

<soap:body use=“encoded“

encodingStyle=“SOAP1.1“namespace=“http://example.com/

ct“.../></input>

</operation></binding>

<soapenv:Envelope...><soapenv:Body>

<m:GetCurrentTemperaturexmlns:m=“http://

example.com/ct><m:cityCode>PDX</

m:cityCode></m:GetCurrentTemperature>

</soapenv:Body></soapenv:Envelope>

http://schemas.xmlsoap.org/soap/encoding/

Page 25: WSDL Web Services Definition Language Von Nikos Vormwald

soap:fault● Bindet Nachrichtenteil an SOAP Fault Details● Use, namespace, encodingStyle gleiche Fkt. wie in soap:body● Parts entfällt da Fehler Nachrichten nur einen Teil haben

<binding...><operation...>

<fault...><soap:fault use=“encoded | literal“

namespace=“uri“ encodingStyle=“uri“/></fault>

</operation></binding>

Page 26: WSDL Web Services Definition Language Von Nikos Vormwald

SMTP Beispiel● Anmeldung zu einer Mailingliste (One-way Operation)

● SMTP am besten geeignet, da Protokoll one-way und asynchron● HTTP ist two-way und synchron

<definitions>

<message name=“SubscribeMailingList“><part name=“email_address“ element=“xsd:string“/><part name=“name_of_list“ element=“xsd:string“/>

</message>

<portType name=“SubscribePortType“><operation name=“SendSubscription“>

<input message=“tns:SubscribeMailingList“></operation>

</portType>

<definitions><definitions><message name=“SubscribeMailingList“><message name=“SubscribeMailingList“>

<part name=“email_address“ <part name=“email_address“ element=“xsd:string“/>element=“xsd:string“/>

<part name=“name_of_list“ <part name=“name_of_list“ element=“xsd:string“/>element=“xsd:string“/></message></message>

<portType name=“SubscribePortType“><portType name=“SubscribePortType“><operation name=“SendSubscription“><operation name=“SendSubscription“>

<input <input message=“tns:SubscribeMailingList“>message=“tns:SubscribeMailingList“>

</operation></operation></portType></portType>

<binding name=“SubscribeListSoapBinding“

type=“tns:SubscribePortType“><soap:binding style=“document“

transport=“http://exmaple.com/smtp“/>

<operation name=“SendSubscription“><input>

<soap:body use=“literal“ parts=“email_address name_of_list“/></input>

</operation></portType>

<service name=“MailingListService“><port name=“MailingListPort“

binding=“tns:SubscribeListSoapBinding“><soap:address

location=“mailto:[email protected]“/></port>

</operation>

</definitions>

Funktion

Übergabeparameter

Page 27: WSDL Web Services Definition Language Von Nikos Vormwald

SMTP Beispiel<binding name=“SubscribeListSoapBinding“

type=“tns:SubscribePortType“><soap:binding style=“document“

transport=“http://exmaple.com/smtp“/><operation name=“SendSubscription“>

<input><soap:body use=“literal“ parts=“email_address

name_of_list“/></input>

</operation></binding>

<service name=“MailingListService“><port name=“MailingListPort“

binding=“tns:SubscribeListSoapBinding“><soap:address location=“mailto:[email protected]“/>

</port></operation>

</definitions>

<definitions><message name=“SubscribeMailingList“>

<part name=“email_address“ element=“xsd:string“/>

<part name=“name_of_list“ element=“xsd:string“/></message>

<portType name=“SubscribePortType“><operation name=“SendSubscription“>

<input message=“tns:SubscribeMailingList“>

</operation></portType>

<binding name=“SubscribeListSoapBinding“<binding name=“SubscribeListSoapBinding“

type=“tns:SubscribePortType“>type=“tns:SubscribePortType“><soap:binding style=“document“<soap:binding style=“document“

transport=“http://transport=“http://exmaple.com/smtp“/>exmaple.com/smtp“/>

<operation name=“SendSubscription“><operation name=“SendSubscription“><input><input>

<soap:body use=“literal“ parts=“email_address name_of_list“/><soap:body use=“literal“ parts=“email_address name_of_list“/></input></input>

</operation></operation></portType></portType>

<service name=“MailingListService“><service name=“MailingListService“><port name=“MailingListPort“<port name=“MailingListPort“

binding=“tns:SubscribeListSoapBinding“>binding=“tns:SubscribeListSoapBinding“><soap:address <soap:address

location=“mailto:[email protected]“/>location=“mailto:[email protected]“/></port></port>

</operation></operation>

</definitions></definitions>

Page 28: WSDL Web Services Definition Language Von Nikos Vormwald

HTTP GET/POST Bindung● 3 verschiedene Arten eine Nachricht an HTTP Adresse zu

binden● HTTP GET mit URL encoding● HTTP GET mit URL replacement● HTTP POST

● Machen Web Service verfügbar für viele Clients● Desktop Browser● WAP Handy● PDA

● Jede Plattform, die HTTP unterstützt kann Service nutzen

Page 29: WSDL Web Services Definition Language Von Nikos Vormwald

HTTP GET/POST BindungBeispiel

● Addition zweier Zahlen● Input: int,int; Output: string

<definitions><message name=“AddInput“>

<part name=“op1“ element=“xsd:int“><part name=“op2“ element=“xsd:int“>

</message><message name=“AddOutput“>

<part name=“result“ element=“xsd:string“/></message>

<portType name=“AddPortType“><operation name=“Add“>

<input message=“AddInput“><output message=“AddOutput“>

</operation></portType>

<definitions><definitions><message name=“AddInput“><message name=“AddInput“>

<part name=“op1“ element=“xsd:int“><part name=“op1“ element=“xsd:int“><part name=“op2“ element=“xsd:int“><part name=“op2“ element=“xsd:int“>

</message></message><message name=“AddOutput“><message name=“AddOutput“>

<part name=“result“ element=“xsd:string“/><part name=“result“ element=“xsd:string“/></message></message>

<portType name=“AddPortType“><portType name=“AddPortType“><operation name=“Add“><operation name=“Add“>

<input message=“AddInput“><input message=“AddInput“><output message=“AddOutput“><output message=“AddOutput“>

</operation></operation></portType></portType>

<binding name=“b3“ type=“AddPortType“><http:binding verb=“POST“/><operation name=“Add“>

<http:operation location=“o1“/><input>

<mime:content type=“application/x-www-form-urlencoded“/></input><output>

<mime:content type=“text/html“/></output>

</operation></binding><binding name=“b2“ type=“AddPortType“>

<http:binding verb=“GET“/><operation name=“Add“>

<http:operation location=“o1“/><input>

<http:urlEncoded/></input><output>

<mime:content type=“text/html“/></output>

</operation></binding><binding name=“b1“ type=“AddPortType“>

<http:binding verb=“GET“/><operation name=“Add“>

<http:operation location=“o1/(op1)/(op2)“/>

<input>

<http:urlReplacement/></input><output>

<mime:content type=“text/html“/></output>

</operation></binding>

<service name=“AddService“><port name=“p1“ binding=“tns:b1“>

<http:address location=“http://example.com“/>

</port><port name=“p2“ binding=“tns:b2“>

<http:address location=“http://example.com“/>

</port><port name=“p3“ binding=“tns:b3“>

<http:address location=“http://example.com“/>

</port></service></definitions>

Page 30: WSDL Web Services Definition Language Von Nikos Vormwald

HTTP GET/POST BindungBeispiel

● HTTP POST Bindung<binding name=“b3“ type=“AddPortType“>

<http:binding verb=“POST“/><operation name=“Add“>

<http:operation location=“o1“/><input>

<mime:content type=“application/x-www-form-urlencoded“/>

</input><output>

<mime:content type=“text/html“/></output>

</operation></binding>● Führt zu Adresse: http://example.com/o1● Parameter in Body des POST: op1=1&op2=2

<definitions><message name=“AddInput“>

<part name=“op1“ element=“xsd:int“><part name=“op2“ element=“xsd:int“>

</message><message name=“AddOutput“>

<part name=“result“ element=“xsd:string“/></message>

<portType name=“AddPortType“><operation name=“Add“>

<input message=“AddInput“><output message=“AddOutput“>

</operation></portType>

<binding name=“<binding name=“b3b3“ type=“AddPortType“>“ type=“AddPortType“><http:binding verb=“<http:binding verb=“POSTPOST“/>“/><operation name=“Add“><operation name=“Add“>

<http:operation location=“o1“/><http:operation location=“o1“/><input><input>

<mime:content type=“application/x-www-form-urlencoded“/><mime:content type=“application/x-www-form-urlencoded“/></input></input><output><output>

<mime:content type=“text/html“/><mime:content type=“text/html“/></output></output>

</operation></operation></binding></binding><binding name=“b2“ type=“AddPortType“>

<http:binding verb=“GET“/><operation name=“Add“>

<http:operation location=“o1“/><input>

<http:urlEncoded/></input><output>

<mime:content type=“text/html“/></output>

</operation></binding><binding name=“b1“ type=“AddPortType“>

<http:binding verb=“GET“/><operation name=“Add“>

<http:operation location=“o1/(op1)/(op2)“/>

<input>

<http:urlReplacement/></input><output>

<mime:content type=“text/html“/></output>

</operation></binding>

<service name=“AddService“><port name=“p1“ binding=“tns:b1“>

<http:address location=“http://example.com“/>

</port><port name=“p2“ binding=“tns:b2“>

<http:address location=“http://example.com“/>

</port><port name=“p3“ binding=“tns:b3“>

<http:address location=“http://example.com“/>

</port></service></definitions>

Kommt vom port Element am Ende

Page 31: WSDL Web Services Definition Language Von Nikos Vormwald

HTTP GET/POST BindungBeispiel

● HTTP GET mit url encoding<binding name=“b2“ type=“AddPortType“>

<http:binding verb=“GET“/><operation name=“Add“>

<http:operation location=“o1“/><input>

<http:urlEncoded/></input><output>

<mime:content type=“text/html“/></output>

</operation></binding>

● Führt zu Adresse: http://example.com/o1?op1=2&op2=2● Parameter als query string

<definitions><message name=“AddInput“>

<part name=“op1“ element=“xsd:int“><part name=“op2“ element=“xsd:int“>

</message><message name=“AddOutput“>

<part name=“result“ element=“xsd:string“/></message>

<portType name=“AddPortType“><operation name=“Add“>

<input message=“AddInput“><output message=“AddOutput“>

</operation></portType>

<binding name=“b3“ type=“AddPortType“><http:binding verb=“POST“/><operation name=“Add“>

<http:operation location=“o1“/><input>

<mime:content type=“application/x-www-form-urlencoded“/></input><output>

<mime:content type=“text/html“/></output>

</operation></binding><binding name=“<binding name=“b2b2“ type=“AddPortType“>“ type=“AddPortType“>

<http:binding verb=“<http:binding verb=“GETGET“/>“/><operation name=“Add“><operation name=“Add“>

<http:operation location=“o1“/><http:operation location=“o1“/><input><input>

<http:urlEncoded/><http:urlEncoded/></input></input><output><output>

<mime:content type=“text/html“/><mime:content type=“text/html“/></output></output>

</operation></operation></binding></binding><binding name=“b1“ type=“AddPortType“>

<http:binding verb=“GET“/><operation name=“Add“>

<http:operation location=“o1/(op1)/(op2)“/>

<input>

<http:urlReplacement/></input><output>

<mime:content type=“text/html“/></output>

</operation></binding>

<service name=“AddService“><port name=“p1“ binding=“tns:b1“>

<http:address location=“http://example.com“/>

</port><port name=“p2“ binding=“tns:b2“>

<http:address location=“http://example.com“/>

</port><port name=“p3“ binding=“tns:b3“>

<http:address location=“http://example.com“/>

</port></service></definitions>

Page 32: WSDL Web Services Definition Language Von Nikos Vormwald

HTTP GET/POST BindungBeispiel

● HTTP GET mit url replacement<binding name=“b1“ type=“AddPortType“>

<http:binding verb=“GET“/><operation name=“Add“>

<http:operation location=“o1/(op1)/(op2)“/><input>

<http:urlReplacement/></input><output>

<mime:content type=“text/html“/></output>

</operation></binding>

● Führt zu Adresse: http://example.com/o1/1/2● Werte der Parameter Teil der Adresse

<definitions><message name=“AddInput“>

<part name=“op1“ element=“xsd:int“><part name=“op2“ element=“xsd:int“>

</message><message name=“AddOutput“>

<part name=“result“ element=“xsd:string“/></message>

<portType name=“AddPortType“><operation name=“Add“>

<input message=“AddInput“><output message=“AddOutput“>

</operation></portType>

<binding name=“b3“ type=“AddPortType“><http:binding verb=“POST“/><operation name=“Add“>

<http:operation location=“o1“/><input>

<mime:content type=“application/x-www-form-urlencoded“/></input><output>

<mime:content type=“text/html“/></output>

</operation></binding><binding name=“b2“ type=“AddPortType“>

<http:binding verb=“GET“/><operation name=“Add“>

<http:operation location=“o1“/><input>

<http:urlEncoded/></input><output>

<mime:content type=“text/html“/></output>

</operation></binding><binding name=“<binding name=“b1b1“ type=“AddPortType“>“ type=“AddPortType“>

<http:binding verb=“<http:binding verb=“GETGET“/>“/><operation name=“Add“><operation name=“Add“>

<http:operation <http:operation location=“o1location=“o1/(op1)/(op2)/(op1)/(op2)“/>“/>

<input><input>

<http:urlReplacement/><http:urlReplacement/></input></input><output><output>

<mime:content type=“text/html“/><mime:content type=“text/html“/></output></output>

</operation></operation></binding></binding>

<service name=“AddService“><port name=“p1“ binding=“tns:b1“>

<http:address location=“http://example.com“/>

</port><port name=“p2“ binding=“tns:b2“>

<http:address location=“http://example.com“/>

</port><port name=“p3“ binding=“tns:b3“>

<http:address location=“http://example.com“/>

</port></service></definitions>

Page 33: WSDL Web Services Definition Language Von Nikos Vormwald

HTTP GET/POST BindungBeispiel

● Alle 3 Bindungen in einem Service anbieten

<service name=“AddService“><port name=“p1“ binding=“tns:b1“>

<http:address location=“http://example.com“/></port><port name=“p2“ binding=“tns:b2“>

<http:address location=“http://example.com“/></port><port name=“p3“ binding=“tns:b3“>

<http:address location=“http://example.com“/></port>

</service>

</definitions>

<definitions><message name=“AddInput“>

<part name=“op1“ element=“xsd:int“><part name=“op2“ element=“xsd:int“>

</message><message name=“AddOutput“>

<part name=“result“ element=“xsd:string“/></message>

<portType name=“AddPortType“><operation name=“Add“>

<input message=“AddInput“><output message=“AddOutput“>

</operation></portType>

<binding name=“b3“ type=“AddPortType“><http:binding verb=“POST“/><operation name=“Add“>

<http:operation location=“o1“/><input>

<mime:content type=“application/x-www-form-urlencoded“/></input><output>

<mime:content type=“text/html“/></output>

</operation></binding><binding name=“b2“ type=“AddPortType“>

<http:binding verb=“GET“/><operation name=“Add“>

<http:operation location=“o1“/><input>

<http:urlEncoded/></input><output>

<mime:content type=“text/html“/></output>

</operation></binding><binding name=“b1“ type=“AddPortType“>

<http:binding verb=“GET“/><operation name=“Add“>

<http:operation location=“o1/(op1)/(op2)“/>

<input>

<http:urlReplacement/></input><output>

<mime:content type=“text/html“/></output>

</operation></binding>

<service name=“AddService“><service name=“AddService“><port name=“p1“ binding=“tns:b1“><port name=“p1“ binding=“tns:b1“>

<http:address <http:address location=“http://example.com“/>location=“http://example.com“/>

</port></port><port name=“p2“ binding=“tns:b2“><port name=“p2“ binding=“tns:b2“>

<http:address <http:address location=“http://example.com“/>location=“http://example.com“/>

</port></port><port name=“p3“ binding=“tns:b3“><port name=“p3“ binding=“tns:b3“>

<http:address <http:address location=“http://example.com“/>location=“http://example.com“/>

</port></port></service></service></definitions></definitions>

Page 34: WSDL Web Services Definition Language Von Nikos Vormwald

MIME Bindung● Eingabe: Stadtcode; Ausgabe: Temperatur, HTML-Dokument

mit Wochenaussicht<definitions...>

<message name=“CurrentTempRequest“><part name=“cityCode“ element=“xsd:string“/>

<message><message name=“CurrentTempReponse“>

<part name=“currentTemp“ element=“xsd:float“><part name=“forecast“ element=“xsd:string“>

</message>

<portType name=“TempPort“><operation name=“GetCurrentTemp“>

<input message=“tns:CurrentTempRequest“><output message=“tns:CurrentTempResponse“>

</operation></portType>

<definitions...><definitions...>

<message name=“CurrentTempRequest“><message name=“CurrentTempRequest“><part name=“cityCode“ <part name=“cityCode“

element=“xsd:string“/>element=“xsd:string“/><message><message><message name=“CurrentTempReponse“><message name=“CurrentTempReponse“>

<part name=“currentTemp“ <part name=“currentTemp“ element=“xsd:float“>element=“xsd:float“>

<part name=“forecast“ <part name=“forecast“ element=“xsd:string“>element=“xsd:string“></message></message>

<portType name=“TempPort“><portType name=“TempPort“><operation <operation

name=“GetCurrentTemp“>name=“GetCurrentTemp“><input <input

message=“tns:CurrentTempRequest“>message=“tns:CurrentTempRequest“><output <output

message=“tns:CurrentTempResponse“>message=“tns:CurrentTempResponse“></operation></operation>

</portType></portType>

<binding name=“CurrentTempSOAP“

type=“tns:TempPort“><soap:binding style=“document“

transport=“http://schemas.xmlsoap.org/soap/http“/>

<operation name=“GetCurrentTemp“>

<input>

<soap:body use=“literal“/></input><output>

<mime:multipartRelated>

<mime:part>

<soap:body parts=“currentTemp“ use=“literal“>

</mime:part>

<mime:part>

<mime:content part=“forecast“ type=“text/html“>

</mime:part>

<operation></binding></definitions>

Page 35: WSDL Web Services Definition Language Von Nikos Vormwald

mime:multipartRelated und mime:content

<binding name=“CurrentTempSOAP“type=“tns:TempPort“>

<soap:binding style=“document“transport=“http://schemas.xmlsoap.org/

soap/http“/><operation name=“GetCurrentTemp“>

<input><soap:body use=“literal“/>

</input><output>

<mime:multipartRelated><mime:part>

<soap:body parts=“currentTemp“ use=“literal“>

</mime:part><mime:part>

<mime:content part=“forecast“ type=“text/html“>

</mime:part></mime:multipartRelated>

</output></operation></binding></definitions>

Repräsentiert einen MIME Typ

(text/html, image/gif)

<definitions...>

<message name=“CurrentTempRequest“><part name=“cityCode“

element=“xsd:string“/><message><message name=“CurrentTempReponse“>

<part name=“currentTemp“ element=“xsd:float“>

<part name=“forecast“ element=“xsd:string“></message>

<portType name=“TempPort“><operation

name=“GetCurrentTemp“><input

message=“tns:CurrentTempRequest“><output

message=“tns:CurrentTempResponse“></operation>

</portType>

<binding name=“CurrentTempSOAP“<binding name=“CurrentTempSOAP“

type=“tns:TempPort“>type=“tns:TempPort“><soap:binding style=“document“<soap:binding style=“document“

transport=“http://transport=“http://schemas.xmlsoap.org/soap/http“/>schemas.xmlsoap.org/soap/http“/>

<operation <operation name=“GetCurrentTemp“>name=“GetCurrentTemp“>

<input><input>

<soap:body use=“literal“/><soap:body use=“literal“/></input></input><output><output>

<mime:multipartRelated><mime:multipartRelated>

<mime:part><mime:part>

<soap:body <soap:body parts=“currentTemp“ use=“literal“>parts=“currentTemp“ use=“literal“>

</mime:part></mime:part>

<mime:part><mime:part>

<mime:content part=“forecast“ type=“text/html“><mime:content part=“forecast“ type=“text/html“>

</mime:part></mime:part>

<operation><operation></binding></binding></definitions></definitions>

Bindet verschiedene Nachrichtenteile an verschiedene MIME

Typen

Page 36: WSDL Web Services Definition Language Von Nikos Vormwald

2 Tools● Microsoft SOAP Toolkit

● COM (Visual Basic) Objekt -> WSDL● IBM Web Services Toolkit

● COM Objekt, Java Class, EJB Jar File -> WSDL

Page 37: WSDL Web Services Definition Language Von Nikos Vormwald

IBM Web Services Toolkit● Java Class -> WSDL

public class MathServer {

public MathServer() {super();

}

public int Add(int op1, int op2) {return 0;

}

}

<definitions...>

<message name=“InAddRequest“><part name=“meth1_inType1“

type=“xsd:int“><part name=“meth1_inType2“

type=“xsd:int“></message>

<message name=“OutAddResponse“><part name=“meth1_outType“

type=“xsd:int“></message>

<portType name=“MathServer_Service“><operation name=“Add“>

<input message=“InAddRequest“><output

message=“OutAddResponse“></operation>

</portType>

<binding...><service...></definitions>

Page 38: WSDL Web Services Definition Language Von Nikos Vormwald

Zusammenfassung● WSDL stellt einen benötigten Teil eines Web Services zu

Verfügung● Es muss einen üblichen Weg geben, Web Services zu

beschreiben● Typen die benutzt werden● Protokolle an die sie gebunden werden

● WSDl baut auf existierenden Standards auf● XSD, SOAP, MIME

● IBM und Microsoft haben WSDL übernommen, andere folgen● WSDL füllt die Lücke zwischen SOAP und UDDI