Post on 06-Jan-2016
description
Hauptseminar Web ServicesW3C Standards I: SOAP, WSDL, UDDI
Tania Fichtner
Technische Universität München, Lehrstuhl für Informatik
24. April 2003, München
Agenda:
0. Web Services
- Einführung, Architektur, Vorgehen
1. SOAP
- Beispiel, SOAP Nachricht, Datencodierung
2. WSDL
- WSDL, Struktur, Beispiel
3. UDDI
- UDDI Registry, Kernbestandteile, Datenmodell, Beispiel
0. Web Services
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
Web Services. Service Orientierte Architektur
Dienste- Registry
HTTP, FTP, SMTP, …
Nimmt Dienst in Anspruch
Sucht nach Dienst
Dienste- Konsument
Dienste- Anbieter
Anmeldung
• Nachrichtenaustausch
• Dienst Beschreibung
• Veröffentlichen / Finden
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
EntdeckungsschichtEntdeckungsschicht
BeschreibungsschichtBeschreibungsschicht
XML-Messaging -schichtXML-Messaging -schicht
TransportschichtTransportschichtHTTP, SMTP, FTP, BEEP
Web Services. „Web Service Protocol Stack“
UDDI
WSDL
SOAP
UDDIUDDI
WSDL
SOAP
Web Service
1. SOAP. Simple Object Access Protocol
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
SOAP. Einführung
• XML basiertes Datentransportprotokoll.
• Umfasst Formatierung von Daten.
• Kann in verschiedenen Nachrichten Systemen benutzt,
und über verschiedene Transportprotokolle versendet
werden.
Im Vordergrund: entfernte Methodenaufrufe (RPC) via HTTP.
• Ermöglicht Dienst- und Datenaustausch.
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
SOAP. Request & Response. Ein Beispiel.
SOAP response:„Wert: 4.32“
SOAP response:„Wert: 4.32“
LinuxJava
SOAPclient
SOAPclient
W2KC++
SOAPclient
SOAPclient
SOAP request:„Was ist der Wert
der Aktie: 923258?“
SOAP request:„Was ist der Wert
der Aktie: 923258?“
RealtimeKursServiceRealtimeKursService
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
<?xml version='1.0' ?>
<env:Envelope xmlns:env=” http://www.w3.org/2002/12/soap-envelope” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=”http://www.w3.org/2001/XMLSchema”>
<env:Body> <ns1:getKurs xmlns:ns1=”urn:RealTimeKursService”> <wkn xsi:type=“xsd:string“>923835</wkn> </ns1:getKurs></env:Body>
</env:Envelope>
SOAP. Request Nachricht: Ein Beispiel.
SOAP request:„Was ist der Wert
der Aktie: 923258?“
SOAP request:„Was ist der Wert
der Aktie: 923258?“
SOAPclient
SOAPclient
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
<?xml version='1.0' ?>
<env:Envelope xmlns:env=” http://www.w3.org/2002/12/soap-envelope” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=”http://www.w3.org/2001/XMLSchema”>
<env:Body> <ns1:getKurs xmlns:ns1=”urn:RealTimeKursService”> <wkn xsi:type=“xsd:string“>923835</wkn> </ns1:getKurs></env:Body>
</env:Envelope>
SOAP. Request Nachricht: Ein Beispiel.
SOAP request:„Was ist der Wert
der Aktie: 923258?“
SOAP request:„Was ist der Wert
der Aktie: 923258?“
SOAPclient
SOAPclient
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
SOAP. Response Nachricht: Ein Beispiel.
SOAP response:„Wert: 4.32“
SOAP response:„Wert: 4.32“
SOAPclient
SOAPclient
<?xml version='1.0' ?>
<env:Envelope xmlns:env=” http://www.w3.org/2002/12/soap-envelope” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=”http://www.w3.org/2001/XMLSchema”>
<env:Body> <ns1:getKursResponse xmlns:ns1=”urn:RealTimeKursService” env:encodingStyle= ”http://schemas.xmlsoap.org/soap/encoding/” > <wert xsi:type=“xsd:string“>4.32</wert> </ns1:getKursResponse></env:Body>
</env:Envelope>
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
SOAP. Response Nachricht: Ein Beispiel.
SOAP response:„Wert: 4.32“
SOAP response:„Wert: 4.32“
SOAPclient
SOAPclient
<?xml version='1.0' ?>
<env:Envelope xmlns:env=” http://www.w3.org/2002/12/soap-envelope” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=”http://www.w3.org/2001/XMLSchema”>
<env:Body> <ns1:getKursResponse xmlns:ns1=”urn:RealTimeKursService” env:encodingStyle= ”http://schemas.xmlsoap.org/soap/encoding/” > <wert xsi:type=“xsd:string“>4.32</wert> </ns1:getKursResponse></env:Body>
</env:Envelope>
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
<?xml version='1.0' ?>
<env:Envelope xmlns:env=” http://www.w3.org/2002/12/soap-envelope” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=”http://www.w3.org/2001/XMLSchema”>
<env:Body> <ns1:getKursResponse xmlns:ns1=”urn:RealTimeKursService” env:encodingStyle= ”http://schemas.xmlsoap.org/soap/encoding/” > <wert xsi:type=“xsd:string“>4.32</wert> </ns1:getKursResponse></env:Body>
</env:Envelope>
SOAP. Response Nachricht: Ein Beispiel.
SOAP response:„Wert: 4.32“
SOAP response:„Wert: 4.32“
SOAPclient
SOAPclient
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
Envelope
<env:Envelope>
</env:Envelope>
SOAP Dokument
<env:Header>...
</env:Header>
Header (optional)
<env:Body>...
</env:Body>
Body
Fault (optional)
Header Block 1 (optional)
Header Block 2 (optional)
SOAP. Nachricht
URI:”http://www.w3.org/2002/12/soap-envelope“URI:”http://www.w3.org/2002/12/soap-envelope“
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
• Optional.
• Erweiterungen für Nachrichtenpfad.
• Drei Attribute: „role“, „mustUnderstand“ und „relay“.
SOAP. Header
SOAP Sender
SOAP Sender
SOAP Empfänger
SOAP Empfänger
SOAP Intermediary
SOAP Intermediary …
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
<env:Envelope xmlns:env=“...”> <env:Header> <p:einBlock xmlns:p=“someURI" env:role=“.../role/next" env:mustUnderstand="true">
... </p:einBlock> <q:Blockzwei xmlns:q=“someURI"
env:relay="true"> ... </q:Blockzwei> <r:Blockdrei xmlns:r=“someURI"> ... </r:Blockdrei></env:Header>
<env:Body > ... </env:Body></env:Envelope>
SOAP. Header
Muss er interpretiert werden?Muss er interpretiert werden?
Wie wird er verarbeitet?Wie wird er verarbeitet?
Wer wird angesteuert?Wer wird angesteuert?
roleenv:role=“.../role/next"mustUnderstandenv:mustUnderstand="true"
relayenv:relay="true"
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
SOAP. Body
• Informationen für den Empfänger.
• Fehler im Body signalisiert.
Body
Fault• Code - Element
• Reason – Element- Text - Element
• Detail - Element (optional)
• Node - Element (optional)
• Role – Element (optional)
- Value - Element- Subcode - Element (optional) reason: Menschen lesbare Meldungreason: Menschen lesbare Meldung
node: Wer hat Fehler verursachtnode: Wer hat Fehler verursacht
code: Spezifiziert Fehlercode: Spezifiziert Fehler
role: Rolle des Knotensrole: Rolle des Knotens
detail: Anwendung spezifischdetail: Anwendung spezifisch
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
SOAP. Datencodierung
• Eigene Datentypdefinition.
• Standard: „http://www.w3.org/2002/12/soap-encoding“
• Attribut env:encodingStyle.
• Zwei Kategorien Datentypen:
– Einfache: atomare Datentypen
– Zusammengesetzte: Structs und arrays.
Datentypen wie in jeder Programmiersprache.
2. WSDL. Web Services Description Language
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
Dienste-Anbieter WSDLWSDL
Aufbau WSDL Dokument
WSDL. Einführung
• XML basierte Sprache.
• Beschreibung von Web Services.
• Enthält URL des Web Service.
Abstrakte Definition Binding
PortTypeMessages
Types
Implementation
ServicePort
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
WSDL. Struktur eines WSDL Dokuments I
• Die WSDL Spezifikation definiert sechs Hauptteile
<definitions>
<types>
<message>
<porType>
<binding>
<service>
WSDL WurzelelementWSDL Wurzelelement
Welche Datentypen werden gesendet?Welche Datentypen werden gesendet?
Welche Nachrichten werden gesendet?Welche Nachrichten werden gesendet?
Welche Operationen werden unterstützt?Welche Operationen werden unterstützt?<operation>
Wie wird die Nachricht übermittelt?Wie wird die Nachricht übermittelt?
Wo ist der Web Service zu finden?Wo ist der Web Service zu finden?<port>
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
WSDL. Struktur eines WSDL Dokuments II
• WSDL Spezifikation noch zwei weitere Elemente.
<definitions>
<import>
<documentation>
...
Importiert externe WSDL Ressourcen.Importiert externe WSDL Ressourcen.
Für Menschen leserliche Information. Für Menschen leserliche Information.
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
WSDL. Beispiel: RealtimeKursService
<definitions>: Das RealtimeKursservice
<message>:
<porType>:
<binding>:
<service>:
1) getKursRequest: wkn Parameter2) getKursResponse Aktienkurs Parameter
getKurs Operation, die aus einem Request/Response- Dienst besteht.
Anweisung das SOAP HTTP Transport Protokoll zu benutzen.
Der Dienst ist unter der Adresse„http://localhost:8080/axis/services/“ zu finden.
<types>:Definition des ComplexType Aktienkurs.
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
WSDL. Spezifikation: <definitions>
• WSDL Wurzelelement.
<definitions name=„RealtimeKursService“ targetnamespace=”http://.../wsdl/ RealtimeKursService.wsdl” xmlns=”http://schemas.xmlsoap.org/wsdl/” xmlns:soap=„http://schemas.xmlsoap.org/wsdl/soap“ xmlns:tns1=”http://.../wsdl/ RealtimeKursService.wsdl” xmlns:xsd=”http://www.w3.org/2001/XMLSchema”>
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
WSDL. Spezifikation: <types>
• Datentypen die nicht im XML Schema-Standard sind.
<types> <schema xmlns=http://www.w3.org/2001/XMLSchema targetNamespace=“RealtimeKursService“> <complexType name=“Aktienkurs“> <sequence> <element name=”name” nillable=”true” type=”xsd:string” /> <element name=”wkn” nillable=”true” type=”xsd:string” /> <element name=”kurs” type=”xsd:double” /> </sequence> </complexType> <element name=”Aktienkurs” nillable=”true” type=”tns1:Aktienkurs” /> </schema></types>
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
WSDL. Spezifikation: <message>
• Ausgetauschten Nachrichten.
• Parameter im part Subelement definiert.
<message name=”getKursResponse”> <part name=”return” type=”tns1:Aktienkurs” /></message>
<message name=”getKurstRequest”> <part name=”wkn” type=”xsd:string” /></message>
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
WSDL. Spezifikation: <portType> und <operation>
• Die am Web Service aufrufbaren Methoden.
• Subelement operation.
<portType> <operation name=”getKurs” parameterOrder=”wkn”> <input message=”tns1:getKursRequest” /> <output message=”tns1:getKursResponse” /> </operation></portType>
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
WSDL. Spezifikation: <portType> und <operation>
• Kommunikation Muster des operation Elements:
ClientClient ServerServer
ClientClient ServerServer
ClientClient ServerServer
ClientClient ServerServer
<input><input>
<input><input>
<output><output>
1.
2.
<output><output>
<input><input>
1.
2.
<output><output>
„One-way“:
„Request-response“:
„Solicit-response“:
„Notification“:
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
WSDL. Spezifikation: <binding>
• Beschreibt wie ein Web Service mit dem Client kommuniziert (HTTP GET, HTTP POST, SOAP).<binding name=”RealtimekursService-Binding” type=”tns1:RealtimeKursService”> <soap:binding style=”rpc” transport=”...soap/http”/> <operation name=”getKurs”> <soap:operation soapAction=”getKurs”/> <input> <soap:body use=”encoded” encodingStyle=”.../encoding” namespace=”.../RealtimeKursService”/> </input> <output> <soap:body use=”encoded” encodingStyle=http://.../encoding namespace=”.../RealtimeKursService”/> </output> </operation></binding>
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
WSDL. Spezifikation: <service> und <port>
• Adresse des Web Services.
• port: Registrierungs- name des Web Services.
• adress: URL des Web Service.
<service name=”RealtimeKursService_Service”> <port name=”RealtimeKursService” binding=”RealtimekursService-Binding”> <soap:address location=“http://localhost:8080/axis/ services/RealtimeKursService/”> </port> <documentation>WSDL File für RealtimeKursService </documentation></service>
3. UDDI. Universal Description, Discovery and Integration
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
UDDI. Einführung
• Standard um Web Services zugänglich machen.
Dienste- Registry
Business+
Service+
Technik
UDDI Registry
Sucht nach Dienst
veröffentlicht
Nimmt Dienst in Anspruch
SOAP-Nachricht
SOAP-Nachricht
WSDL
UDDI
Dienste- Konsument
Dienste- Anbieter
- Spezifikation
- Implementation
- Spezifikation
- Implementation
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
UDDI Registry
BusinessBusiness
ServiceService
TechnikTechnik
UDDI. Registry
• Informationen in drei Kategorien aufgeteilt:
„White Pages“
„Yellow Pages“
„Green Pages“
Anbieter zu suchen
Diensttypen zu suchen
Technische Informationen zu suchen
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
UDDI „cloud services“ IBM, Microsoft, SAP angeboten
UDDI. Kernbestandteile
UDDI
1. Datenstruktur
XML Schema
1. Datenstruktur
XML Schema
2. API
Spezifikation
„publishing“ & „inquiry“
functions.
2. API
Spezifikation
„publishing“ & „inquiry“
functions.
3. Replikations- Spezifikation
3. Replikations- Spezifikation
4. Spezifikation für Registry Anbieter
4. Spezifikation für Registry Anbieter
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
UDDI. Datenmodell
• UDDI basiert auf XML Schema.
<BusinessEntity>
</BusinessEntity>
<BusinessEntity>
</BusinessEntity>
<BusinessService>
</BusinessService>
<BusinessService>
</BusinessService>
tModeltModel
tModeltModel
tModeltModel
tModeltModel
<BindingTemplate>…</BindingTemplate>
<BindingTemplate>…</BindingTemplate>
<BindingTemplate>…</BindingTemplate>
<BindingTemplate>…</BindingTemplate>
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
UDDI. Beispiel
• http://uddi.microsoft.com
• UDDI Suchpfad:
BusinessEntity
BusinessService
BindingTemplate
tModel
BusinessEntity
BusinessService
BindingTemplate
tModel
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
UDDI. Beispiel XMethods
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
Zusammenfassung
• Anforderungen einer Web Service Architektur:
- Kompatibilität
- Integration im WWW
- Skalierbarkeit & Erweiterbarkeit
- Benutzer- & Web- freundlich
- Sicherheit
- Funktionssicherheit /
Zuverlässigkeit
- Management
- Kompatibilität
- Integration im WWW
- Skalierbarkeit & Erweiterbarkeit
- Benutzer- & Web- freundlich
- Sicherheit
- Funktionssicherheit /
Zuverlässigkeit
- Management
? ?
Vielen Dank für Ihre Aufmerksamkeit!
Anhang I. Back Up
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
SOAP Nachricht. XML Schema für Element env
...<xs:element name=“Envelope“ type=“tns:Envelope“>
<xs:complexType name=“Envelope“><xs:sequence>
<xs:element ref=“tns:Header“ minOccurs=“0“/>
<xs:element ref=“tns:Body“ minOccurs=“1“/>
<xs:any namespace=”##other” minOccurs=“0“maxOccurs=”unbounded”processContents=”lax”/>
</xs:sequence>...
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
SOAP Header. Attribut „role“
• „role“-Attribut:– Definiert welcher SOAP-Knoten sich um die Auswertung des
Header Blocks kümmerns soll.– Es gibt 3 standardisierte Rollen:
„none“, „next“, „ultimateReceiver“
Knoten/RoleSenderIntermediaryEmpfänger
Nicht vorhandenn/aneinja
„none“n/aneinnein
„next“n/ajaja
„ultimateReceiver“n/aneinja
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
SOAP Header. Attribut „mustUnderstand“
• „mustUnderstand“-Attribut:– Teilt dem jeweiligen SOAP-Knoten mit, ob er den
zugehörigen Header-Block interpretieren muss.
Knoten„mustUnderstand“„true“„false“Nicht vorhanden
Intermediary
obligatorischoptionaloptional
Empfänger
obligatorischoptionaloptional
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
SOAP Header. Attribute
• „relay“-Attribut:– Zeigt an was getan werden muss, falls der Header-Block
nicht vom angesteuerten SOAP-Knoten verarbeitet wurde.
Role Header block
Short-name
Assumed
Understood & Processed
Forwarded
next Yes
YesNo, unless reinserted
NoNo, unless relay ="true"
user-definedYes
YesNo, unless reinserted
NoNo, unless relay ="true"
No n/a Yes
ultimateReceiver Yes
Yes n/a
No n/a
none No n/a Yes
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
SOAP. Fault-Beispiel<env:Body><env:Fault>
<env:Code> <env:Value>Client.Authentication</env:Value> <env:Subcode>
<env:Value>rpc:BadArguments</env:Value> </env:Subcode></env:Code><env:Reason> <env:Text xml:lang="de">Login-Daten sind
ungültig</env:Text> <env:text xml:lang="en-US">Login Data not
valid</env:Text></env:Reason><env:Detail> <e:FehlerDetails
xmlns:e="http://www.beispiel.org/faults"> <e:message>Name does not match
logindata</e:message> </e:FehlerDetails></env:Detail>
</env:Fault></env:Body>
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
SOAP. Datentypen: Einfache Datentypen
• Atomare Datentypen.• Einfache Datentypen der XML Schema Spezifikation.
<?xml version='1.0' ?><env:Envelope xmlns:env="http://www.w3.org/2002/12/soap-envelope" xmlns:env-ENC="http://www.w3.org/2002/12/soap-encoding" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" env-ENC:encodingstyle="http://www.w3.org/2002/12/soap- encoding">
<env:Body><getKurs> <wkn xsi:type=”xsd:string”>923835</wkn></getKurs>
</env:Body>
</env:Envelope>
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
• SOAP Arrays mit xsi:type- und arrayType- Attributen festgelegt.
• Multidimensionale Arrays möglich.
SOAP. Datentypen: Zusammengesetzte Datentypen
<env:Body> <getKursResponse env:encodingStyle=“http://www.w3.org/2002/12/soap- encoding">
<Return xmlns:ns1=“http://www.w3.org/2002/12/soap-encoding“ xsi:type=“ns1:Array“ ns1:arrayType=“xsd:string[3]“> <item xsi:type=”xsd:string”>923835</item> <item xsi:type=”xsd:string”>IBM</item> <item xsi:type=”xsd:double”>4.32</item></Return>
</getKursResponse></env:Body>
24. April 2003 Hauptseminar Web Services – W3C Standards I: SOAP, WSDL, UDDI
SOAP. Datentypen: Zusammengesetzte Datentypen
• Struct: Zusammensetzung mehrere atomarer Datentypen zu einem Hochtyp.
...<env:Body> <getKursResponse env:encodingStyle=“http://www.w3.org/2002/12/soap- encoding">
<aktie> <wkn xsi:type=”xsd:string”>923835</wkn> <name xsi:type=”xsd:string”>IBM</name> <wert xsi:type=”xsd:double”>4.32</wert></aktie>
</getKursResponse></env:Body>...