Präsentation herunterladen
Die Präsentation wird geladen. Bitte warten
1
WSDL Web Services Definition Language
Von Nikos Vormwald
2
Übersicht Einleitung (3-4) WSDL Syntax (8)
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)
3
WSDL – Einleitung Was ist WSDL? Was sind Web Services?
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
4
WSDL – Einleitung Was ist WSDL nicht? Was wird mit WSDL beschrieben?
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?)
5
WSDL – Geschichte Vorher: SOAP „Lösungen“: Probleme
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
6
WSDL – Geschichte Lösung: WSDL Von IBM, Microsoft und Ariba
WSDL März 2001 Struktur: XML; Datentypen: XSD
7
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
8
WSDL Syntax Grundlagen: Warum WSDL Syntax lernen?
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
9
WSDL Syntax Elementenübersicht
Types <types> Messages <message> Operations <operation> Port types <portType> Bindings <binding> Ports <port> Services <service>
10
Porttyp-Operation-Message-Typ Struktur
11
Das Element <types>
<schema targetNamespace=“ xmlns=“ <element name=“CurrentTemperatureRequest“> <complexType> <all> <element name=“cityCode“ type=“string“/> </all> </complexType> </element> <element name=“CurrentTemperature“> <element name=“temp“ type=“float“/> </schema> </types>
12
Das Element <message>
Besteht aus Teilen (Parts) Jeder Part ist ein Typ/Element <message name=“InputMessage“> <part name=“body“ element=“xsd1:CurrentTemperatureRequest“> </message> <message name=“OutputMessage“> <part name=“body“ element=“xsd1:CurrentTemperature“> 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
13
Die Elemente <portTyp> und <operation>
Operation ~ Funktion mit Eingabe, Ausgabe, Ausnahmen Porttyp mit mehreren Operationen <portType name=“CurrentTemperaturePortType“> <operation name=“GetCurrentTemperature“> <input name=“Input“ message=“InputMessage“> <output name=“Output“ message=“OutputMessage“> <fault name=“Fault“ message=“FaultMessage“> </operation> </portType>
14
Service-Port-Binding-Porttyp Struktur
15
Das Element <binding>
Definiert, wie eine Operation an ein Protokoll gebunden wird <binding name=“CurrentTemperatureSoapBinding“ type=“CurrentTemperaturePortType“> <soap:binding style=“document“ transport=“ <operation name=“GetCurrentTemperature“> <soap:operation soapOperation=“ <input> <soap:body use=“literal“/> </input> <output> </output> </operation> </binding>
16
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=“ </port> </service>
17
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) Notification Operation (keine Bindung vorhanden) Output (periodischer Statusreport)
18
Protokoll Bindungen SAOP HTTP GET/POST MIME soap:binding
soap:operation soap:body soap:fault SMTP Beispiel HTTP GET/POST MIME mime:multipartRelated mime:content mime:mimeXml
19
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>
20
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>
21
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>
22
Beispielwerte und zugehörige SOAP Nachrichten
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>
23
Beispielwerte und zugehörige SOAP Nachrichten
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>
24
Beispielwerte und zugehörige SOAP Nachrichten
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=“ </input> </operation> </binding> <soapenv:Envelope...> <soapenv:Body> <m:GetCurrentTemperature xmlns:m=“ <m:cityCode>PDX</m:cityCode> </m:GetCurrentTemperature> </soapenv:Body> </soapenv:Envelope>
25
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>
26
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=“Subscrib ingList“> <part name=“ _address“ element=“xsd:string“/> <part name=“name_of_list“ element=“xsd:string“/> </message> <portType name=“SubscribePortType“> <operation name=“SendSubscription“> <input message=“tns:Subscrib ingList“> </operation> </portType> <binding name=“SubscribeListSoapBinding“ type=“tns:SubscribePortType“> <soap:binding style=“document“ transport=“ <input> <soap:body use=“literal“ parts=“ _address name_of_list“/> </input> <service name=“MailingListService“> <port name=“MailingListPort“ binding=“tns:SubscribeListSoapBinding“> <soap:address </port> </definitions> Übergabe-parameter <definitions> <message name=“Subscrib ingList“> <part name=“ _address“ element=“xsd:string“/> <part name=“name_of_list“ element=“xsd:string“/> </message> <portType name=“SubscribePortType“> <operation name=“SendSubscription“> <input message=“tns:Subscrib ingList“> </operation> </portType> Funktion
27
SMTP Beispiel <binding name=“SubscribeListSoapBinding“
type=“tns:SubscribePortType“> <soap:binding style=“document“ transport=“ <operation name=“SendSubscription“> <input> <soap:body use=“literal“ parts=“ _address name_of_list“/> </input> </operation> </binding> <service name=“MailingListService“> <port name=“MailingListPort“ binding=“tns:SubscribeListSoapBinding“> <soap:address </port> </definitions> <definitions> <message name=“Subscrib ingList“> <part name=“ _address“ element=“xsd:string“/> <part name=“name_of_list“ element=“xsd:string“/> </message> <portType name=“SubscribePortType“> <operation name=“SendSubscription“> <input message=“tns:Subscrib ingList“> </operation> </portType> <binding name=“SubscribeListSoapBinding“ type=“tns:SubscribePortType“> <soap:binding style=“document“ transport=“ <input> <soap:body use=“literal“ parts=“ _address name_of_list“/> </input> <service name=“MailingListService“> <port name=“MailingListPort“ binding=“tns:SubscribeListSoapBinding“> <soap:address </port> </definitions>
28
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
29
HTTP GET/POST Bindung Beispiel
<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“/> <portType name=“AddPortType“> <operation name=“Add“> <input message=“AddInput“> <output message=“AddOutput“> </operation> </portType> <binding name=“b3“ type=“AddPortType“> < verb=“POST“/> < location=“o1“/> <input> <mime:content type=“application/x-www-form-urlencoded“/> </input> <output> <mime:content type=“text/html“/> </output> </binding> <binding name=“b2“ type=“AddPortType“> < verb=“GET“/> < <binding name=“b1“ type=“AddPortType“> < location=“o1/(op1)/(op2)“/> < <service name=“AddService“> <port name=“p1“ binding=“tns:b1“> < location=“ </port> <port name=“p2“ binding=“tns:b2“> <port name=“p3“ binding=“tns:b3“> </service> </definitions> 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“/> <portType name=“AddPortType“> <operation name=“Add“> <input message=“AddInput“> <output message=“AddOutput“> </operation> </portType>
30
HTTP GET/POST Bindung Beispiel
<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“/> <portType name=“AddPortType“> <operation name=“Add“> <input message=“AddInput“> <output message=“AddOutput“> </operation> </portType> <binding name=“b3“ type=“AddPortType“> < verb=“POST“/> < location=“o1“/> <input> <mime:content type=“application/x-www-form-urlencoded“/> </input> <output> <mime:content type=“text/html“/> </output> </binding> <binding name=“b2“ type=“AddPortType“> < verb=“GET“/> < <binding name=“b1“ type=“AddPortType“> < location=“o1/(op1)/(op2)“/> < <service name=“AddService“> <port name=“p1“ binding=“tns:b1“> < location=“ </port> <port name=“p2“ binding=“tns:b2“> <port name=“p3“ binding=“tns:b3“> </service> </definitions> HTTP POST Bindung <binding name=“b3“ type=“AddPortType“> < verb=“POST“/> <operation name=“Add“> < location=“o1“/> <input> <mime:content type=“application/x-www-form-urlencoded“/> </input> <output> <mime:content type=“text/html“/> </output> </operation> </binding> Kommt vom port Element am Ende Führt zu Adresse: Parameter in Body des POST: op1=1&op2=2
31
HTTP GET/POST Bindung Beispiel
<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“/> <portType name=“AddPortType“> <operation name=“Add“> <input message=“AddInput“> <output message=“AddOutput“> </operation> </portType> <binding name=“b3“ type=“AddPortType“> < verb=“POST“/> < location=“o1“/> <input> <mime:content type=“application/x-www-form-urlencoded“/> </input> <output> <mime:content type=“text/html“/> </output> </binding> <binding name=“b2“ type=“AddPortType“> < verb=“GET“/> < <binding name=“b1“ type=“AddPortType“> < location=“o1/(op1)/(op2)“/> < <service name=“AddService“> <port name=“p1“ binding=“tns:b1“> < location=“ </port> <port name=“p2“ binding=“tns:b2“> <port name=“p3“ binding=“tns:b3“> </service> </definitions> HTTP GET mit url encoding <binding name=“b2“ type=“AddPortType“> < verb=“GET“/> <operation name=“Add“> < location=“o1“/> <input> < </input> <output> <mime:content type=“text/html“/> </output> </operation> </binding> Führt zu Adresse: Parameter als query string
32
HTTP GET/POST Bindung Beispiel
<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“/> <portType name=“AddPortType“> <operation name=“Add“> <input message=“AddInput“> <output message=“AddOutput“> </operation> </portType> <binding name=“b3“ type=“AddPortType“> < verb=“POST“/> < location=“o1“/> <input> <mime:content type=“application/x-www-form-urlencoded“/> </input> <output> <mime:content type=“text/html“/> </output> </binding> <binding name=“b2“ type=“AddPortType“> < verb=“GET“/> < <binding name=“b1“ type=“AddPortType“> < location=“o1/(op1)/(op2)“/> < <service name=“AddService“> <port name=“p1“ binding=“tns:b1“> < location=“ </port> <port name=“p2“ binding=“tns:b2“> <port name=“p3“ binding=“tns:b3“> </service> </definitions> HTTP GET mit url replacement <binding name=“b1“ type=“AddPortType“> < verb=“GET“/> <operation name=“Add“> < location=“o1/(op1)/(op2)“/> <input> < </input> <output> <mime:content type=“text/html“/> </output> </operation> </binding> Führt zu Adresse: Werte der Parameter Teil der Adresse
33
HTTP GET/POST Bindung Beispiel
<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“/> <portType name=“AddPortType“> <operation name=“Add“> <input message=“AddInput“> <output message=“AddOutput“> </operation> </portType> <binding name=“b3“ type=“AddPortType“> < verb=“POST“/> < location=“o1“/> <input> <mime:content type=“application/x-www-form-urlencoded“/> </input> <output> <mime:content type=“text/html“/> </output> </binding> <binding name=“b2“ type=“AddPortType“> < verb=“GET“/> < <binding name=“b1“ type=“AddPortType“> < location=“o1/(op1)/(op2)“/> < <service name=“AddService“> <port name=“p1“ binding=“tns:b1“> < location=“ </port> <port name=“p2“ binding=“tns:b2“> <port name=“p3“ binding=“tns:b3“> </service> </definitions> Alle 3 HTTP Bindungen in einem Service anbieten <service name=“AddService“> <port name=“p1“ binding=“tns:b1“> < location=“ </port> <port name=“p2“ binding=“tns:b2“> <port name=“p3“ binding=“tns:b3“> </service> </definitions>
34
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> <binding name=“CurrentTempSOAP“ type=“tns:TempPort“> <soap:binding style=“document“ transport=“ <input> <soap:body use=“literal“/> </input> <output> <mime:multipartRelated> <mime:part> <soap:body parts=“currentTemp“ use=“literal“> </mime:part> <mime:content part=“forecast“ type=“text/html“> <operation> </binding> </definitions> <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>
35
mime:multipartRelated und mime:content
<binding name=“CurrentTempSOAP“ type=“tns:TempPort“> <soap:binding style=“document“ transport=“ <operation name=“GetCurrentTemp“> <input> <soap:body use=“literal“/> </input> <output> <mime:multipartRelated> <mime:part> <soap:body parts=“currentTemp“ use=“literal“> </mime:part> <mime:content part=“forecast“ type=“text/html“> </mime:multipartRelated> </output></operation></binding> </definitions> <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“ type=“tns:TempPort“> <soap:binding style=“document“ transport=“ <input> <soap:body use=“literal“/> </input> <output> <mime:multipartRelated> <mime:part> <soap:body parts=“currentTemp“ use=“literal“> </mime:part> <mime:content part=“forecast“ type=“text/html“> <operation> </binding> </definitions> Bindet verschiedene Nachrichtenteile an verschiedene MIME Typen Repräsentiert einen MIME Typ (text/html, image/gif)
36
2 Tools Microsoft SOAP Toolkit IBM Web Services Toolkit
Für COM (Visual Basic) Objekt -> WSDL IBM Web Services Toolkit Für COM Objekt, Java Class, EJB Jar File -> WSDL
37
IBM Web Services Toolkit
<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“> <portType name=“MathServer_Service“> <operation name=“Add“> <input message=“InAddRequest“> <output message=“OutAddResponse“> </operation> </portType> <binding...><service...> </definitions> Java Class -> WSDL public class MathServer { public MathServer() { super(); } public int Add(int op1, int op2) { return 0;
38
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
Ähnliche Präsentationen
© 2025 SlidePlayer.org Inc.
All rights reserved.