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

37
1 Core Web Services Standards

Upload: lawrence-nicholson

Post on 28-Dec-2015

218 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request

1

Core Web Services Standards

Page 2: 1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request

2

(Simplified) Web Service Architecture

Registry

1. Service Registers

PUBLISH

3. Client calls Service

BIND

2. Client Request Service Location

FIND

WebService

ServiceClient

Page 3: 1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request

3

SOAP (Simple Object

Access Protocol)

Page 4: 1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request

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

Page 5: 1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request

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

Page 6: 1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request

6

What does SOAP Define?

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

protocols

Page 7: 1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request

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

Page 8: 1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request

8

SOAP Message Envelope● Encoding information● Header

Optional Could contain context knowledge

● Security● Transaction

● Body RPC methods and parameters Contains application data

Page 9: 1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request

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

Page 10: 1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request

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>

Page 11: 1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request

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>

Page 12: 1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request

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>

Page 13: 1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request

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>

Page 14: 1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request

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>

Page 15: 1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request

15

Quick WSDL Tutorial

Page 16: 1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request

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)

Page 17: 1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request

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

Page 18: 1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request

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

Page 19: 1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request

19

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

WSDL Elements

Page 20: 1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request

20

WSDL Elements

● Types Data type definitions Used to describe exchanged

messages Uses W3C XML Schema as canonical

type system

Page 21: 1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request

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>

Page 22: 1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request

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

Page 23: 1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request

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>

Page 24: 1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request

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

Page 25: 1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request

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>

Page 26: 1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request

26

UDDI

Page 27: 1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request

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

Page 28: 1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request

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

Page 29: 1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request

29

Other Web Services

Standards

Page 30: 1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request

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

Page 31: 1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request

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

Page 32: 1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request

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)

Page 33: 1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request

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

Page 34: 1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request

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)

Page 35: 1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request

35

Web Service Components

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

Web services

components

Page 36: 1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request

36

Summary

Page 37: 1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request

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