1 core web services standards. 2 (simplified) web service architecture registry 1. service registers...

Post on 28-Dec-2015

218 Views

Category:

Documents

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

1

Core Web Services Standards

2

(Simplified) Web Service Architecture

Registry

1. Service Registers

PUBLISH

3. Client calls Service

BIND

2. Client Request Service Location

FIND

WebService

ServiceClient

3

SOAP (Simple Object

Access Protocol)

4

SOAP

● Simple Object Access Protocol● Wire protocol similar to

IIOP for CORBA JRMP for RMI

● XML is used for data encoding “text” based protocol vs. “binary”

protocol● Supports XML-based RPC

5

What SOAP is Not

● Not a component model So it will not replace objects and

components, i.e. EJB, JavaBeans● Not a programming language

So it will not replace Java● Not a solution for all

So it will not replace other distributed computing technologies such as RMI

6

What does SOAP Define?

● Message Envelope● Encoding Rules● RPC Convention● Binding with underlying

protocols

7

SOAP Message Format

SOAP Envelope

SOAP Header

SOAP Message

Primary MIME part(text/xml)

Attachment

Attachment

SOAP Body

Header Entry

Header Entry

Body Entry

Body Entry

Attachment

8

SOAP Message Envelope● Encoding information● Header

Optional Could contain context knowledge

● Security● Transaction

● Body RPC methods and parameters Contains application data

9

SOAP Encoding

• Rules of expressing application-defined data types in XML

• Based on W3C XML Schema• Simple values

– Built-in types from XML Schema, Part 2 (simple types, enumerations, arrays of bytes)

• Compound values– Structs, arrays, complex types

10

SOAP RPC Request Example

<SOAP-ENV:Envelope xmlns:SOAP-ENV="…" SOAP-ENV:encodingStyle="…">

<SOAP-ENV:Header> <!-- Optional context information -->

</SOAP-ENV:Header>

<SOAP-ENV:Body>   <m:GetLastTradePrice xmlns:m=“some_URI">     <tickerSymbol>SUNW</tickerSymbol>   </m:GetLastTradePrice></SOAP-ENV:Body>

</SOAP-ENV:Envelope>

11

SOAP RPC Response Example

<SOAP-ENV:Envelope xmlns:SOAP-ENV="…" SOAP-ENV:encodingStyle="…">

<SOAP-ENV:Header> <!-- Optional context information -->

</SOAP-ENV:Header>

<SOAP-ENV:Body>  <m:GetLastTradePriceResponse xmlns:m=“some_URI">     <price>30.5</price>  </m:GetLastTradePriceResponse></SOAP-ENV:Body>

</SOAP-ENV:Envelope>

12

SOAP RPC

● Information needed for a method call:

The URI of the target object

<SOAP-ENV:Body> <m:GetLastTradePrice

xmlns:m=“http://stocks.com/StockQuotes"> <tickerSymbol>SUNW</tickerSymbol> </m:GetLastTradePrice> </SOAP-ENV:Body>

13

SOAP RPC

● Information needed for a method call:

The URI of the target object Method name

<SOAP-ENV:Body> <m:GetLastTradePrice

xmlns:m=“http://stocks.com/StockQuotes"> <tickerSymbol>SUNW</tickerSymbol> </m:GetLastTradePrice> </SOAP-ENV:Body>

14

SOAP RPC

● Information needed for a method call:

The URI of the target object Method name Parameters

<SOAP-ENV:Body> <m:GetLastTradePrice

xmlns:m=“http://stocks.com/StockQuotes"> <tickerSymbol>SUNW</tickerSymbol> </m:GetLastTradePrice> </SOAP-ENV:Body>

15

Quick WSDL Tutorial

16

What is WSDL?• XML language for describing web

services• Web service is described as

– A set of communication endpoints (ports) • Endpoint is made of two parts

– Abstract definitions of operations and messages

– Concrete binding to networking protocol (and corresponding endpoint address) and message format

• Why this separation?– Enhance reusability (as we will see in UDDI

reference to WSDL document)

17

Why WSDL?

• Enables automation of communication details between communicating partners– Machines can read WSDL– Machines can invoke a service defined in

WSDL

• Discoverable through registry • Arbitration

– 3rd party can verify if communication conforms to WSDL

18

WSDL Document Example

● Simple service providing stock quotes

● A single operation called GetLastTradePrice

● Deployed using SOAP 1.1 over HTTP

● Request takes a ticker symbol of type string

● Response returns price as a float

19

● Types● Message● Operation● Port Type ● Binding● Port● Service

WSDL Elements

20

WSDL Elements

● Types Data type definitions Used to describe exchanged

messages Uses W3C XML Schema as canonical

type system

21

WSDL Example: Types<definitions name="StockQuote" targetNamespace="http://example.com/stockquote.wsdl" xmlns:tns="http://example.com/stockquote.wsdl" xmlns:xsd1="http://example.com/stockquote.xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/”> <types> <schema targetNamespace="http://example.com/stockquote.xsd" xmlns="http://www.w3.org/2000/10/XMLSchema"> <element name="TradePriceRequest"> <complexType> <all> <element name=”tickerSymbol" type="string"/> </all> </complexType> </element> <element name="TradePrice"> <complexType> <all> <element name="price" type="float"/> </all> </complexType> </element> </schema> </types>

22

WSDL Elements● Messages

Abstract, typed definitions of data being exchanged

● Operations Abstract description of an action Refers to an input and/or output

messages● Port type

Collection of operations Abstract definition of a service

23

Example: Messages, Operation, Port type<message name="GetLastTradePriceInput"> <part name="body" element="xsd1:TradePriceRequest"/></message>

<message name="GetLastTradePriceOutput"> <part name="body" element="xsd1:TradePrice"/></message>

<portType name="StockQuotePortType"> <operation name="GetLastTradePrice"> <input message="tns:GetLastTradePriceInput"/> <output message="tns:GetLastTradePriceOutput"/> </operation> <!-- More operations --></portType>

24

WSDL Elements● Binding

Concrete protocol and data format for a particular Port type

Protocol example: SOAP 1.1 over HTTP or SOAP 1.1 over SMTP

● Port Defines a single communication endpoint Endpoint address for binding URL for HTTP, email address for SMTP

● Service Aggregate set of related ports

25

Example: Binding, Port, Service<binding name="StockQuoteSoapBinding" type="tns:StockQuotePortType"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="GetLastTradePrice"> <soap:operation soapAction="http://example.com/GetLastTradePrice"/> <input> <soap:body use="literal" /> </input> <output> <soap:body use="literal" /> </output> </operation></binding>

<service name="StockQuoteService"> <documentation>My first service</documentation> <port name="StockQuotePort" binding="tns:StockQuoteBinding"> <soap:address location="http://example.com/stockquote"/> </port></service>

26

UDDI

27

Service Architecture

UDDI defines a way to publish and find information about Web services.

UDDI Registr

y

1. Service Registers

PUBLISH

3. Client calls Service

BIND

2. Client Request Service Location

FIND

WebService

ServiceClient

28

UDDI (Universal Description, Discovery and Integration)● “White pages”

– address, contact, and known identifiers

● “Yellow pages”– industrial categorizations

● Industry: NAICS (Industry codes - US Govt.)● Product/Services: UN/SPSC (ECMA)● Location: Geographical taxonomy

● “Green pages”– technical information about services

29

Other Web Services

Standards

30

ebXML

A global electronic market place where enterprises of any size, anywhere can:– Find each other electronically– Conduct business through exchange of

XML based business messages

31

More Web Services Standards● Security

XML Signature, XML Encryption, XKMS, XACML, SAML, Liberty, WS-Security

● Transaction BTP, WS-Transaction

● Business collaboration and choreography

ebXML BPSS, ebXML CPP/CPA, BPML, WSFL, XLANG, WSCI, BPEL4WS

32

More Web Services Standards

● Business Language UBL (Universal Business Language)

● Component model WSIA (Web Services for Interactive

Application)● Portal

WSRP (Web Services for Remote Portals)

33

What Is a Web Service?● A set of endpoints (ports) operating

on messages● Ports are operating within a container

Container provides runtime environment Contract for runtime environment are

specified in JAX-RPC, EJB 2.1, JSR 109● Service is described in WSDL

document and published to a registry WSDL specifies a contract between service

provider and client

34

Web Service Component and Container● Container vs. Component model

Web services components get executed within a container

Components are portable (under J2EE 1.4)

● Web service components Web-tier (Servlet-based endpoint)

EJB-tier (Stateless session bean-based endpoint)

35

Web Service Components

Source: Web Services for J2EE (JSR 109), V1.0

Web services

components

36

Summary

37

Summary

● Web services provides a new paradigm for program to program communication

● Comprehensive set of Java APIs for Web Services are now available!

● J2EE is the platform of choice for Web services

top related