Web Services Web Services UDDI managing registries of Web services - - PowerPoint PPT Presentation

web services web services
SMART_READER_LITE
LIVE PREVIEW

Web Services Web Services UDDI managing registries of Web services - - PowerPoint PPT Presentation

Objectives Objectives SOAP exchanging XML messages on a network An Introduction An Introduction to XML and Web Technologies to XML and Web Technologies WSDL describing interfaces of Web services Web Services Web Services


slide-1
SLIDE 1

1

An Introduction An Introduction to XML and Web Technologies to XML and Web Technologies

Web Services Web Services

Anders Møller & Michael I. Schwartzbach  2006 Addison-Wesley

2

An Introduction to XML and Web Technologies

Objectives Objectives

SOAP – exchanging XML messages on a network WSDL – describing interfaces of Web services UDDI – managing registries of Web services

3

An Introduction to XML and Web Technologies

What is a Web Service? What is a Web Service?

Web Service:

“software that makes services available on a network using technologies such as XML and HTTP”

Service-Oriented Architecture (SOA):

“development of applications from distributed collections of smaller loosely coupled service providers”

4

An Introduction to XML and Web Technologies

Why a New Framework? Why a New Framework?

CORBA, DCOM, Java/RMI, ... already exist XML+HTTP: platform neutral, widely accepted and utilized

slide-2
SLIDE 2

2

5

An Introduction to XML and Web Technologies

What do We Need? What do We Need?

We already know how to

  • represent information with XML
  • communicate with HTTP

Fault tolerance Intermediaries RPC Interface descriptions Locating services ...

ad hoc solutions vs. use of standards?

6

An Introduction to XML and Web Technologies

A Recipe Server with XML and HTTP A Recipe Server with XML and HTTP

Ad hoc, RPC-style:

  • Recipes getReci

Recipes pes()

  • Lock lockRecipe

cipe(ID)

  • void writeRecip

ecipe(Lock,Recipe)

  • void unlockReci

Recipe pe(Lock)

7

An Introduction to XML and Web Technologies

Example Request ( Example Request (writeRecipe writeRecipe writeRecipe writeRecipe) )

POST /personal/jdoe/recipeserver HTTP/1.0 Host: www.widget.inc Content-Type: text/xml Content-length: 5714 <?xml version="1.0"?> <call xmlns="http://www.brics.dk/ixwt/xmlrpc" xmlns:rcp="http://www.brics.dk/ixwt/recipes"> <operation>writeRecipe</operation> <arg>4DHX5ZV3D871AQ09</arg> <arg> <rcp:recipe id="r105"> <rcp:title>Cailles en Sarcophages</rcp:title> <rcp:date>Tue, 26 Sep 06</rcp:date> ... </rcp:recipe> </arg> </call>

8

An Introduction to XML and Web Technologies

Example Response ( Example Response (lockRecipe lockRecipe lockRecipe lockRecipe) )

HTTP/1.1 200 OK Date: Tue, 26 Sep 2006 22:29:08 GMT+1 Content-Type: text/xml Content-Length: 101 <?xml version="1.0"?> <return xmlns="http://www.brics.dk/ixwt/xmlrpc"> 4DHX5ZV3D871AQ09 </return>

slide-3
SLIDE 3

3

9

An Introduction to XML and Web Technologies

XML XML-

  • RPC

RPC

A (too) simple RPC protocol based on XML and HTTP Close to the ad hoc approach in the Recipe Server...

10

An Introduction to XML and Web Technologies

Web Service Standards Web Service Standards

SOAP WSDL UDDI WS-*

  • WS-Addressing
  • WS-ReliableMessaging
  • WS-Security, WS-Policy
  • WS-Resource
  • WS-Choreography (WS-CDL)
  • WS-BPEL (aka. BPEL4WS)
  • WS-Coordination, WS-AtomicTransaction, WS-CAF
  • ...

SERVICE REGISTRY SERVICE USER SERVICE PROVIDER publish messages find UNDER DEVELOPMENT!

11

An Introduction to XML and Web Technologies

SOAP SOAP

Used to be “Simple Object Access Protocol”, but no longer an acronym... Processing Model Data Representation and RPC Binding to transport protocols (e.g. HTTP)

12

An Introduction to XML and Web Technologies

The SOAP Processing Model The SOAP Processing Model

SOAP Envelope:

INITIAL SENDER INTERMEDIARY INTERMEDIARY INTERMEDIARY ULTIMATE RECEIVER <Envelope xmlns="http://www.w3.org/2003/05/soap-envelope"> <Header>...</Header> <Body>...</Body> </Envelope>

slide-4
SLIDE 4

4

13

An Introduction to XML and Web Technologies

Envelope Headers Envelope Headers

Encryption information Access control Routing Auditing Data extensions ...

14

An Introduction to XML and Web Technologies

A SOAP Message A SOAP Message

<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:w="http://www.widget.inc/shop" xmlns:n="http://notaries.example.org"> <env:Header> <w:ticket>54B42CF401A</w:ticket> <n:token> <n:value>32158546</n:value> <n:issuer>http://notarypublic.example.com</n:issuer> </n:token> </env:Header> <env:Body> <w:buy> <w:product>light gadget</w:product> <w:amount>430</w:amount> </w:buy> </env:Body> </env:Envelope>

15

An Introduction to XML and Web Technologies

Special SOAP Header Attributes Special SOAP Header Attributes

role

  • next
  • ultimateReceiver
  • none

mustUnderstand relay encodingStyle

16

An Introduction to XML and Web Technologies

Another Example Another Example

<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:c="http://encodings.example.org" xmlns:r="http://routings.example.org"> <env:Header> <c:encoding env:role env:role="ht ="http://e tp://encod ncodings ings.examp .example.o le.org/d rg/decoder ecoder" env: env:must mustUnde Understand rstand="tr ="true" ue"> gzip+base64 </c:encoding> <r:route env:rel env:relay=" ay="true true" env:rol nv:role= e= "http:/ http://www /www.w3. .w3.org/20

  • rg/2003/0

03/05/so 5/soap-env ap-envelop elope/ro e/role/nex le/next"> <r:node>130.225.16.12</r:node> <r:node>10.11.40.201</r:node> </r:route> </env:Header> <env:Body> H4sICACI/0EAA3EA80jNycnXUSjPL8pJUeQCABinVXsOAAAA </env:Body> </env:Envelope>

slide-5
SLIDE 5

5

17

An Introduction to XML and Web Technologies

Faults Faults

<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:w="http://www.widget.inc/shop"> <env:Body> <env env:F :Fau ault> lt> <e <env nv:C :Code

  • de>

<e <env nv:Va :Value lue>e >env: nv:Se Send nder< er</en /env: v:Val Value ue> <e <env nv:Su :Subco bcode de> <e <env: nv:Val Value ue>w:InvalidBuyRequest</env </env:Va :Valu lue> e> </ </en env:S v:Subc ubcod

  • de>

e> </ </en env: v:Cod Code> e> <e <env nv:R :Reas eason>

  • n>

<e <env nv:Te :Text xm xt xml:l l:lan ang= g="en "en"> "> The value of 'amount' is invalid! </ </en env:T v:Text ext> <e <env nv:Te :Text xm xt xml:l l:lan ang= g="da "da"> "> Værdien af 'amount' er ugyldig! </ </en env:T v:Text ext> </ </en env: v:Rea Reason son> </en /env: v:Fa Fault ult> </env:Body> </env:Envelope>

18

An Introduction to XML and Web Technologies

SOAP Encoding SOAP Encoding

XML serialization of data graphs

name spouse mother family father name name father name spouse Jane Dow Jack Doe John Doe Zacharias Doe

19

An Introduction to XML and Web Technologies

SOAP Encoding, cont. SOAP Encoding, cont.

<family xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns: xmlns:enc="http://ww enc="http://www.w3.org/2003/ w.w3.org/2003/05/soap-encodi 05/soap-encoding" ng" env:en env:encodingStyle= codingStyle= "http://www.w "http://www.w3.org/2003/05/ 3.org/2003/05/soap-encoding" soap-encoding" xmlns="http://www.widget.inc/encoding"> <name>Jack Doe</name> <father enc:id="1"> <name>John Doe</name> <father> <name>Zacharias Doe</name> </father> <spouse enc:ref="2"/> </father> <mother enc:id="2"> <name>Jane Dow</name> <spouse enc:ref="1"/> </mother> </family>

20

An Introduction to XML and Web Technologies

RPC in SOAP RPC in SOAP

<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:rs="http://www.brics.dk/ixwt/recipeserver" xmlns:rcp="http://www.brics.dk/ixwt/recipes"> <env:Body> <rs:writeR <rs:writeRecipe env:enco ecipe env:encodingStyle= dingStyle= "http://www.w3 "http://www.w3.org/2003/05/s .org/2003/05/soap-encoding">

  • ap-encoding">

<rs:lock <rs:lock>4DHX5ZV3D871AQ09</rs:lock> </rs:lock> <rs:reci <rs:recipe env:encodin pe env:encodingStyle= gStyle= "http://xml.ap "http://xml.apache.org/xml-s ache.org/xml-soap/literalxml

  • ap/literalxml">

"> <rcp:r <rcp:recipe id="r105 ecipe id="r105"> "> <rcp <rcp:title> :title>Cailles en Sarcophages</rcp:title> </rcp:title> <rcp <rcp:date> :date>Tue, 26 Sep 06</rcp:da </rcp:date> te> ... </rcp: </rcp:recipe> recipe> </rs:rec </rs:recipe> ipe> </rs:write </rs:writeRecipe> Recipe> </env:Body> </env:Envelope>

slide-6
SLIDE 6

6

21

An Introduction to XML and Web Technologies

Flexibility of SOAP Flexibility of SOAP

SOAP can be used without using SOAP Encoding SOAP can be used with other conventions for RPC than SOAP RPC SOAP can be used with other communication patterns than SOAP RPC

22

An Introduction to XML and Web Technologies

Protocol Binding Protocol Binding

Transmission protocols: HTTP, SMTP, ... Route from initial sender to ultimate receiver may involve different protocols RPC fits nicely into HTTP request–response

23

An Introduction to XML and Web Technologies

HTTP Binding in SOAP HTTP Binding in SOAP

Message exchange patterns:

  • request–response (for RPC) ⇒ POST
  • SOAP response ⇒ GET

HTTP/1 HTTP/1.1 2 .1 200 O 00 OK Conten Content-Ty t-Type: applic pe: applicatio ation/so n/soap+xml ap+xml; ; ch charse arset="utf t="utf-8"

  • 8"

Conten Content-Le t-Length ngth: 273 : 273 <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:rs="http://www.brics.dk/ixwt/recipeserver"> <env:Body> <rs:writeRecipeResponse env:encodingStyle= "http://www.w3.org/2003/05/soap-encoding"/> </env:Body> </env:Envelope>

24

An Introduction to XML and Web Technologies

Summary of SOAP Summary of SOAP

A transport neutral protocol for XML data interchange (but focusing on HTTP) Processing model (envelopes, intermediaries, ...) SOAP Encoding SOAP RPC Protocol Bindings Foundation of WS-*

slide-7
SLIDE 7

7

25

An Introduction to XML and Web Technologies

WSDL WSDL Web Services Description Language

Functionality? (operations, types of arguments) Access? (data encoding, communication protocols) Location? – Necessary information for writing clients – Automatic generation of stubs and skeletons

26

An Introduction to XML and Web Technologies

Structure of a WSDL Description Structure of a WSDL Description

<description xmlns="http://www.w3.org/2004/08/wsdl" targetNamespace="..." ...> <types> <!-- XML Sc XML Schem hema a des descr crip iptio tion o n of typ types es b bein eing u g used in mes messag sages es --> ... </types> <interface name="..."> <!-- list o list of o

  • perat

ratio ions ns an and t d their ir in inpu put a t and nd ou

  • utpu

tput --> ... </interface> <binding name="..." interface="..." type="..."> <!-- messag message e e encodi

  • ding

ngs s and and co comm mmuni unica cati tion

  • n pro

proto tocol cols --> ... </binding> <service name="..." interface="..."> <!-- combin combinati ation

  • n of
  • f an int

interf erfac ace, a bi e, a bindi nding, ng, and a ser a servi vice lo ce loca catio tion --> ... </service> </description>

27

An Introduction to XML and Web Technologies

Recipe Server with WSDL and SOAP (1/6) Recipe Server with WSDL and SOAP (1/6)

<description xmlns="http://www.w3.org/2004/08/wsdl" targetNamespace="http://www.brics.dk/ixwt/recipes/wsdl" xmlns:x="http://www.brics.dk/ixwt/recipes/wsdl"> <types types> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace= "http://www.brics.dk/ixwt/recipes/wsdl/types" xmlns:t="http://www.brics.dk/ixwt/recipes/wsdl/types"> <xs:import namespace="http://www.brics.dk/ixwt/recipes" schemaLocation="recipes.xsd"/> <xs:element name="lock"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:length value="16"/> </xs:restriction> </xs:simpleType> </xs:element>

28

An Introduction to XML and Web Technologies

Recipe Server with WSDL and SOAP (2/6) Recipe Server with WSDL and SOAP (2/6)

<xs:element name="lockError" type="xs:string"/> <xs:element name="getRecipes"> <xs:complexType><xs:sequence/></xs:complexType> </xs:element> <xs:element name="lockRecipe"> <xs:complexType> <xs:sequence> <xs:element name="id" type="xs:NMTOKEN"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="lockRecipeResponse"> <xs:complexType> <xs:sequence> <xs:element ref="t:lock"/> </xs:sequence> </xs:complexType> </xs:element>

slide-8
SLIDE 8

8

29

An Introduction to XML and Web Technologies

Recipe Server with WSDL and SOAP (3/6) Recipe Server with WSDL and SOAP (3/6)

<xs:element name="writeRecipe"> <xs:complexType> <xs:sequence> <xs:element ref="t:recipe"/> <xs:element ref="t:lock"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="unlockRecipe"> <xs:complexType> <xs:sequence> <xs:element ref="t:lock"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> </types>

30

An Introduction to XML and Web Technologies

Recipe Server with WSDL and SOAP (4/6) Recipe Server with WSDL and SOAP (4/6)

<inter interfa face ce name="recipeserverInterface" xmlns:t="http://www.brics.dk/ixwt/recipes/wsdl/types" styleDefault="http://www.w3.org/2004/03/wsdl/style/rpc"> <fault name="lockFault" element="t:lockError"/> <operation name="getRecipesOperation" pattern="http://www.w3.org/2004/03/wsdl/in-out"> <input messageLabel="In" element="t:getRecipes"/> <output messageLabel="Out" element="t:collection"/> </operation> <operation name="lockRecipeOperation" pattern="http://www.w3.org/2004/03/wsdl/in-out"> <input messageLabel="In" element="t:lockRecipe"/> <output messageLabel="Out" element="t:lockRecipeResponse"/> <outfault ref="x:lockFault" messageLabel="Out"/> </operation>

31

An Introduction to XML and Web Technologies

Recipe Server with WSDL and SOAP (5/6) Recipe Server with WSDL and SOAP (5/6)

<operation name="writeRecipeOperation" pattern= "http://www.w3.org/2004/03/wsdl/robust-in-only"> <input messageLabel="In" element="t:writeRecipe"/> <outfault ref="x:lockFault"/> </operation> <operation name="unlockRecipeOperation" pattern="http://www.w3.org/2004/03/wsdl/in-only"> <input messageLabel="In" element="t:lock"/> </operation> </interface>

32

An Introduction to XML and Web Technologies

Recipe Server with WSDL and SOAP (6/6) Recipe Server with WSDL and SOAP (6/6)

<bindi binding ng name="recipeserverSOAPBinding" interface="x:recipeserverInterface" type="http://www.w3.org/2004/08/wsdl/soap12" xmlns:ws="http://www.w3.org/2004/08/wsdl/soap12" ws:protocol="http://www.w3.org/2003/05/soap/bindings/HTTP" ws:mepDefault= "http://www.w3.org/2003/05/soap/mep/request-response" xmlns:soap="http://www.w3.org/2003/05/soap-envelope"> <fault ref="x:lockFault" ws:code="soap:Sender"/> </binding> <servi service ce name="recipeserver" interface="x:recipeserverInterface"> <endpoint name="recipeserverEndpoint" binding="x:recipeserverSOAPBinding" address= "http://www.widget.inc/personal/jdoe/recipeserver"/> </service> </description>

slide-9
SLIDE 9

9

33

An Introduction to XML and Web Technologies

Interface Descriptions Interface Descriptions

  • In-Only
  • Robust In-Only
  • In-Out
  • In-Optional-Out
  • Out-Only
  • Robust Out-Only
  • Out-In
  • Out-Optional-In

<operation name="getRecipesOperation" pattern= "http://www.w3.org/2004/03/wsdl/in-out"> <input messageLabel="In" element="t:getRecipes"/> <output messageLabel="Out" element="t:collection"/> </operation>

34

An Introduction to XML and Web Technologies

RPC RPC-

  • Style Operations

Style Operations

Can be used with In-Out, In-Only, Robust In-Only Input/output types must describe element sequences only Wrapper element in request names the operation ...

35

An Introduction to XML and Web Technologies

Binding Descriptions Binding Descriptions

Encodings and protocols for an interface Predefined:

  • SOAP binding (often using SOAP’s HTTP

binding)

  • HTTP binding (“raw HTTP”)

36

An Introduction to XML and Web Technologies

SOAP Binding SOAP Binding

<binding name="recipeserverSOAPBinding" interface="x:recipeserverInterface" type="http://www.w3 http://www.w3.org/2004/08/w .org/2004/08/wsdl/soap12 sdl/soap12" xmlns:ws="http://www.w3.org/2004/08/wsdl/soap12" ws:protocol= "http://www.w3.org/2003/05/soap/bindings/HTTP" xmlns:soap="http://www.w3.org/2003/05/soap-envelope"> <operation ref="x:getRecipesOperation" ws:mep= "http://www.w3.org/2003/05/soap/mep/request-response"/> ... <fault ref="x:lockFault" ws:code="soap:Sender"/> </binding>

slide-10
SLIDE 10

10

37

An Introduction to XML and Web Technologies

HTTP Binding HTTP Binding

<binding name="recipeserverHTTPBinding" interface="x:recipeserverInterface" type="http://www.w3 http://www.w3.org/2004/08/w .org/2004/08/wsdl/http sdl/http" xmlns:wh="http://www.w3.org/2004/08/wsdl/http"> ... <operation ref="x:search" wh:method="GET" wh:location="search-engine/find/{q}"/> <fault ref="x:ServiceUnavailable" wh:code="503"/> </binding>

38

An Introduction to XML and Web Technologies

Service Descriptions Service Descriptions

<service name="recipeserver" interf interface ace="x:recipeserverInterface"> <endpoint name="recipeserverEndpoint" bindin binding="x:recipeserverSOAPBinding" addres address= "http://www.widget.inc/personal/jdoe/recipeserver"/> </service>

39

An Introduction to XML and Web Technologies

Summary of WSDL Summary of WSDL

Description of interfaces of Web services:

  • message types
  • operations
  • encodings and communication protocols
  • location

40

An Introduction to XML and Web Technologies

UDDI UDDI

Universal Description, Discovery, and Integration static / dynamic discovery public / private registries

slide-11
SLIDE 11

11

41

An Introduction to XML and Web Technologies

UDDI Descriptions UDDI Descriptions

publisherAssertion

(describes relations between businesses)

businessEntity

(describes a concrete business)

businessService

(describes a Web service)

bindingTemplate

(describes invocation information)

tModel

(technical details, e.g. reference to WSDL description)

42

An Introduction to XML and Web Technologies

Business Entity for Recipe Server (1/2) Business Entity for Recipe Server (1/2)

<busin businessE essEntit ntity xmlns="urn:uddi-org:api_v3" businessKey="uddi:7398388-7F63-73K3-H314-763272DA7G41"> <name>Widget Inc.</name> <contacts> <contact useType="Chief Executive Officer"> <description>CEO of Widget Inc.</description> <personName>John Doe</personName> <phone useType="CEO">(202) 555-1414</phone> <email useType="CEO">john.doe@widget.inc</email> </contact> </contacts> <businessServices> <busin businessS essService ervice serviceKey="uddi:9X65542-8JE7-8732-U893-8272634H7362" businessKey="uddi:7398388-7F63-73K3-H314-763272DA7G41"> <name>Doe Personal Recipe Server</name> <description> John Doe's personal recipe service </description>

43

An Introduction to XML and Web Technologies

Business Entity for Recipe Server (2/2) Business Entity for Recipe Server (2/2)

<bindingTemplates> <bindi bindingTemp ngTemplate late bindingKey="uddi:8H62363-K725-3345-73V5-823763FS7265" serviceKey="uddi:9X65542-8JE7-8732-U893-8272634H7362"> <accessPoint URLType="http"> http://www.widget.inc/personal/jdoe/recipeserver </accessPoint> <tModelInstanceDetails> <tModelInstanceInfo tModelKey= "uddi:5241HY7-6252-KN72-7291-3126HJ8237A2"/> </tModelInstanceDetails> </bindingTemplate> </bindingTemplates> </businessService> </businessServices> </businessEntity>

44

An Introduction to XML and Web Technologies

tModel for Recipe Server tModel for Recipe Server

<tMode tModel xmlns="urn:uddi-org:api_v3" tModelKey="uddi:5241HY7-6252-KN72-7291-3126HJ8237A2"> <name>Doe Personal Recipe Server</name> <description>John Doe's personal recipe service</description> <overviewDoc> <overviewURL> http://www.widget.inc/personal/jdoe/recipes.wsdl </overviewURL> </overviewDoc> <categoryBag> <keyedReference keyName="uddi-org:types" keyValue="wsdlSpec" tModelKey="uddi:C1ACF26D-9672-4404-9D70-39B756E62AB4"/> <keyedReference keyName="IAAWG" keyValue="WDG18762" tModelKey="uddi:82761UHS-442P-1712-KL82-8272HSH76519"/> </categoryBag> </tModel>

slide-12
SLIDE 12

12

45

An Introduction to XML and Web Technologies

UDDI Discovery UDDI Discovery

<find_ find_serv service ice xmlns="urn:uddi-org:api_v3"> <categoryBag> <keyedReference keyName="IAAWG" keyValue="%" tModelKey="uddi:82761UHS-442P-1712-KL82-8272HSH76519"/> </categoryBag> </find_service> <serviceList xmlns="urn:uddi-org:api_v3"> <serviceInfos> <serviceInfo businessKey="uddi:7398388-7F63-73K3-H314-763272DA7G41" serviceKey="uddi:9X65542-8JE7-8732-U893-8272634H7362"> <name>Doe Personal Recipe Server</name> </serviceInfo> <serviceInfo businessKey="uddi:82736H57-HA32-P581-0021-8373H6S73443" serviceKey="uddi:7252OX72-K23J-4X44-7W23-K82737292527"> <name>Average Recipes on The Web</name> </serviceInfo> </serviceInfos> </serviceList>

46

An Introduction to XML and Web Technologies

Summary Summary

SOAP – a transport neutral protocol for XML data interchange (but focusing on HTTP) WSDL – description of Web service interfaces UDDI – registries and discovery of Web services

47

An Introduction to XML and Web Technologies

Essential Online Resources Essential Online Resources

SOAP:

http://www.w3.org/TR/soap/

WSDL:

http://www.w3.org/2002/ws/desc/

UDDI:

http://www.uddi.org

XML-RPC:

http://www.xmlrpc.com/

The Web Service Interoperability Organization:

http://www.ws-i.org/