Top Banner
In Introduction to Web Services
27

In Introduction to Web Services. Publish-Find-Bind Consuming Program Service Requestor Service Provider http transport SOAP message Service Registry UDDI.

Dec 24, 2015

Download

Documents

Jessie Simon
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: In Introduction to Web Services. Publish-Find-Bind Consuming Program Service Requestor Service Provider http transport SOAP message Service Registry UDDI.

In Introduction to Web Services

Page 2: In Introduction to Web Services. Publish-Find-Bind Consuming Program Service Requestor Service Provider http transport SOAP message Service Registry UDDI.

Publish-Find-Bind

ConsumingProgram

Service Requestor

ServiceProvider

http transport

SOAPmessage

Service Registry

UDDI

Discover services

SOAPmessagehttp transport

Publish services

WSDLdescribing

service

Page 3: In Introduction to Web Services. Publish-Find-Bind Consuming Program Service Requestor Service Provider http transport SOAP message Service Registry UDDI.

SOAP Message•Body - Payload

•Why header?

• Extensibility

• Control/meta Information

•Header is optional

•SOAP Intermediaries

<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">

<env:Header>

...</env:Header>

<env:Body>

... </env:Body>

</env:Envelope>

Page 4: In Introduction to Web Services. Publish-Find-Bind Consuming Program Service Requestor Service Provider http transport SOAP message Service Registry UDDI.

SOAP ArchitectureService

implementationapplication levelClient application

code

Server skeleton

XML unmarshallerClient stub

XML marshaller

TCP/IP socket

remoting architecture level

wire protocol levelhttp protocol httpserver

httpclient

body

envelopeheader header

Page 5: In Introduction to Web Services. Publish-Find-Bind Consuming Program Service Requestor Service Provider http transport SOAP message Service Registry UDDI.

buyer

seller

seller

seller

messagebroker

RFQ

QuoteResponse

Award

Conversational Message Exchange

Page 6: In Introduction to Web Services. Publish-Find-Bind Consuming Program Service Requestor Service Provider http transport SOAP message Service Registry UDDI.

Conversational Message Exchange: A Request

<?xml version='1.0' ?>

<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">

<env:Header> <r:RFQNum xmlns:r=“…” env:mustUnderstand=“true”>101</r:RFQNum><r:custNum env:mustUnderstand=“true”>17</r:custNum></env:Header>

<env:Body><r:RFQ xmlns:r=“http://bigco.example.org/RFQ”>

<r:manufacturer>SanDisk</r:<Manufacturer><r:productname>SecureDigital memory</r:productname><r:size>1GB</r:size><r:quantity>100</r:quantity>

</r:RFQ></env:Body>

</env:Envelope>

Page 7: In Introduction to Web Services. Publish-Find-Bind Consuming Program Service Requestor Service Provider http transport SOAP message Service Registry UDDI.

Conversational Message Exchange: A Response

<?xml version='1.0' ?>

<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header>

<r:RFQNum xmlns:r=“http://bigco.example.org/RFQ”>env:mustUnderstand=“true”>101</m:RFQNum><r:vendorID env:mustUnderstand=“true”>2470</r:vendorID><r:bidNum env:mustUnderstand=“true”>1</r:bidNum><r:custNum env:mustUnderstand=“true”>17<r:custNum>

</env:Header>

<env:Body><r:quoteResponse xmlns:r=“http://bigco.example.org/RFQ”>

<r:manufacturer>KingMax</r:<Manufacturer><r:productName>SecureDigital memory</r:productname><r:size>1GB</r:size><r:speed>9000KB/s</r:speed><r:SKU>KM-SD1000</r:SKU><r:quantity>100</r:quantity>

</r:quoteResponse></env:Body>

</env:Envelope>

Page 8: In Introduction to Web Services. Publish-Find-Bind Consuming Program Service Requestor Service Provider http transport SOAP message Service Registry UDDI.

Conversational Message Exchange: Completion

<?xml version='1.0' ?>

<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">

<env:Header> <r:vendorID env:mustUnderstand=“true”>2470</r:vendorID>

<r:bidNum env:mustUnderstand=“true”>1</r:bidNum>

<r:custNum env:mustUnderstand=“true”>17<r:custNum>

</env:Header><env:Body>

<r:Award xmlns:r=“http://bigco.example.org/RFQ”>

<r:SKU>KM-SD1000</r:SKU>

<r:quantity>50</r:quantity>

</r:Award>

</env:Body>

</env:Envelope>

Page 9: In Introduction to Web Services. Publish-Find-Bind Consuming Program Service Requestor Service Provider http transport SOAP message Service Registry UDDI.

SOAP Faults

• Place faults inside env:Body elements

• env:Fault Element:

• env:Node identifies node which generated fault• Absence indicates “ultimate recipient”

• env:Code • env:Value• env:Subcode

• env:Reason• env:Text

• env:Detail• Application specific

Page 10: In Introduction to Web Services. Publish-Find-Bind Consuming Program Service Requestor Service Provider http transport SOAP message Service Registry UDDI.

SOAP Fault Examples<env:Body>

<env:Fault> <env:Code>

<env:Value>env:Sender</env:Value> <env:Subcode>

<env:Value>rpc:BadArguments</env:Value></env:Subcode>

</env:Code> <env:Reason>

<env:Text xml:lang="en-US">Processing error</env:Text> <env:Text xml:lang="cs">Chyba zpracování</env:Text>

</env:Reason> <env:Detail>

<e:myFaultDetails xmlns:e=http://shippingservice.org/fault><e:message>Unknown destination</e:message> <e:errorcode>999</e:errorcode> </e:myFaultDetails>

</env:Detail> </env:Fault>

</env:Body>

Page 11: In Introduction to Web Services. Publish-Find-Bind Consuming Program Service Requestor Service Provider http transport SOAP message Service Registry UDDI.

SOAP Bindings• Transport of SOAP messages from one SOAP node to another

• Serialized representation of the message POST /Reservations HTTP/1.1Host: marketplace.example.orgContent-Type: application/soap+xml; charset="utf-8"Content-Length: nnnn<?xml version='1.0' ?><env:Envelope xmlns:env=”...”><env:Body>…

From: [email protected]: [email protected]: RFQ: Memory purchaseDate: Thursday, September 9 2004Message-Id: <[email protected]>Content-Type: application/soap+xml<?xml version='1.0' ?><env:Envelope xmlns:env=”...”><env:Body>…

Page 12: In Introduction to Web Services. Publish-Find-Bind Consuming Program Service Requestor Service Provider http transport SOAP message Service Registry UDDI.

WSDL: Introduction• Contract of a web service published by the provider• XML-based Service Description • W3C Candidate Recommendation

• Describe a Web Service?• Operations• Message Exchange Pattern• Messages• Protocol, Address

• WSDL Approach:• Abstract service description• Concrete network protocol and message format• Binding [Abstract -> Concrete]

Page 13: In Introduction to Web Services. Publish-Find-Bind Consuming Program Service Requestor Service Provider http transport SOAP message Service Registry UDDI.

WSDL: Specification<definitions

name="StockQuote" … >

<types>…</types>

<message>…</message>

<portType>

<operation>

</operation>

</portType>

<binding>…</binding>

<service>…</service>

</definitions>

types

message message message

operation

portType/interface

operation operation

binding

serviceport / endpoint

Page 14: In Introduction to Web Services. Publish-Find-Bind Consuming Program Service Requestor Service Provider http transport SOAP message Service Registry UDDI.

WSDL TypesData type definitions using some type system (such as XSD)

<types> <schema targetNamespace=“…“ xmlns="http://www.w3.org/....">

<complexType name=“StockIdentifier">      <sequence>        <element name=“Symbol“ type="xsd:string"/>        <element name=“StockMarket“

type="xsd:sting"/>      </sequence></complexType>

</schema></types>

External Schemas can be imported into the WSDL

<import namespace="http://example.com/stockquote/schemas" location=http://example.com/stockquote/stockquote.xsd />

Page 15: In Introduction to Web Services. Publish-Find-Bind Consuming Program Service Requestor Service Provider http transport SOAP message Service Registry UDDI.

WSDL PortType, Operation, Message

<portType name="StockPriceInterface">

<operation name=“GetStockPrice">

<input message="tns:GetStockPriceInput"/>

<output message="tns:GetStockPriceOutput"/>

</operation>

</portType>

<message name="GetStockPriceInput">

<part name=“stock" element=“xsd1:StockIdentifier"/>

<part name=“time" element="xsd:date"/>

</message>

<message name="GetStockPriceOutput">

<part name=“stock" element=“xsd1:StockIdentifier"/>

<part name=“value" element="xsd:float"/>

</message>

Page 16: In Introduction to Web Services. Publish-Find-Bind Consuming Program Service Requestor Service Provider http transport SOAP message Service Registry UDDI.

WSDL Binding• Maps the abstract service functionality to a specific network protocol and

message format

• Bindings defined for HTTP, SMTP etc..

<binding name="StockQuoteSOAPBinding" type="tns:StockQuotePortType">

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

<operation name="GetStockPrice"><soap:operation soapAction="http://example.com/GetStockPrice"/>

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

</operation>

</binding>

Page 17: In Introduction to Web Services. Publish-Find-Bind Consuming Program Service Requestor Service Provider http transport SOAP message Service Registry UDDI.

<service name="StockQuoteService">

<documentation>My first service</documentation>

<port name="StockQuotePort" binding="tns:StockQuoteSOAPBinding">

<soap:address location="http://example.com/stockquote"/>

</port>

</service>

WSDL Ports and Services

Port: A single endpoint defined as a combination of a binding and a network address.

Service: A collection of related endpoints.

Page 18: In Introduction to Web Services. Publish-Find-Bind Consuming Program Service Requestor Service Provider http transport SOAP message Service Registry UDDI.

WSDL Binding Example:One-way Over SMTP<message name="SubscribeToQuotes">

<part name=“subsBody" element="xsd1:SubscribeToQuotes"/>

<part name="subsHeader"element="xsd1:SubscriptionHeader"/>

</message>

<portType name="StockQuotePortType">

<operation name="SubscribeToQuotesOper"> <input message="tns:SubscribeToQuotes"/>

</operation>

</portType>

<binding name="StockQuoteSoap" type="tns:StockQuotePortType">

<soap:binding style="document" transport="http://example.com/smtp"/><operation name="SubscribeToQuotesOper">

<input message="tns:SubscribeToQuotes"> <soap:body parts=“subsBody" use="literal"/> <soap:header part="subsHeader" use="literal"/>

</input> </operation>

</binding>

<service name="StockQuoteService">

<port name="StockQuotePort" binding="tns:StockQuoteSoap"> <soap:address location="mailto:[email protected]"/>

</port>

</service>

Page 19: In Introduction to Web Services. Publish-Find-Bind Consuming Program Service Requestor Service Provider http transport SOAP message Service Registry UDDI.

UDDI

• Universal Description, Discovery and Integration

• businessEntity - Provider of service

• businessService - Collection of related services

• bindingTemplate - Information necessary to use

• tModel - “reusable concept” such as• Interface• Protocol used by web services• Category

• publisherAssertion - Relationship that business entity has with another businessEntity

• UUID (Universally Unique IDs) as Keys• businessKey, serviceKey, bindingKey , tModelKey

Page 20: In Introduction to Web Services. Publish-Find-Bind Consuming Program Service Requestor Service Provider http transport SOAP message Service Registry UDDI.

businessService

businessService

Interface tModelbindingTemplate

bindingTemplate

businessEntity

bindingTemplate

Interface tModel

Core UDDI Entities

Page 21: In Introduction to Web Services. Publish-Find-Bind Consuming Program Service Requestor Service Provider http transport SOAP message Service Registry UDDI.

tModels

• The “technical fingerprint”• tModel’s define unique identifiers for interfaces and interface

specifications• Once tModel is published service advertises compliance with the

spec represented by including the correct tModelKey

• Value sets• Categorization hierarchies• E.g. categoryBag and identifierBag have references to tModels with

the system of values

Page 22: In Introduction to Web Services. Publish-Find-Bind Consuming Program Service Requestor Service Provider http transport SOAP message Service Registry UDDI.

UDDI APIs• Inquiry

• Browse: find_xx• Drill-down: get_xx

• Invocation• Use browse and drilldown and get bindingTemplate• Invoke from bindingTemplate

• Publication• save_xx• delete_xx

• Subscription, Security, Custody Transfer, Replication

<find_business xmlns="urn:uddi-org:api_v3">

<findQualifiers><findQualifier>uddi:uddi.org:findqualifier:approximatematch</findQualifier>...

</findQualifiers>

<categoryBag><keyedReference keyValue="34.10.%“

tModelKey="uddi:uddi.org:ubr:categorization:unspsc"/></categoryBag>

</find_business>

Page 23: In Introduction to Web Services. Publish-Find-Bind Consuming Program Service Requestor Service Provider http transport SOAP message Service Registry UDDI.

Mapping WSDL to UDDI

Page 24: In Introduction to Web Services. Publish-Find-Bind Consuming Program Service Requestor Service Provider http transport SOAP message Service Registry UDDI.

The value proposition of SOA• Implement SOA for two major reasons.

• First is the ability to save development dollars through reuse of services.

• Second is the ability to change the IT infrastructure faster to adapt to changing needs of the business, or agility.

Page 25: In Introduction to Web Services. Publish-Find-Bind Consuming Program Service Requestor Service Provider http transport SOAP message Service Registry UDDI.

The vision: a true SOA Scenario•Describe the semantics of a client’s need

•Discover a provider of this need or compose multiple services dynamically

•Dynamically understand the protocol of messages to be exchanged with the provider

•Negotiate terms of use of a Service

•Move from one provider to another seamlessly

Page 26: In Introduction to Web Services. Publish-Find-Bind Consuming Program Service Requestor Service Provider http transport SOAP message Service Registry UDDI.

SOA Fabric Requirements

• Publish-Find-Bind paradigm++• Semantics (IOPE)• Context awareness• Trust models• Declarative and dynamic composition• Fabric services similar to “middleware services” of the

past• Transactions, naming etc. • Non repudiation• Metering and Billing (S-Commerce)• Differentiated service levels along with dynamic

provisioning of services

Page 27: In Introduction to Web Services. Publish-Find-Bind Consuming Program Service Requestor Service Provider http transport SOAP message Service Registry UDDI.

Whither WS?

• Many new standards are being formulated that extend WS with these capabilities• WSRF – for stateful interactions• WS Policy – Capabilities and constraint specification• C-WSDL – Context awareness • WS-Coordination – Orchestration• WS-Transactions – Transaction API

• Impact?• Certainly extend it’s usefulness• But …..