Top Banner
Presentation 7: SOAP, WSDL & introduction to UDDI
51

Presentation 7: SOAP, WSDL & introduction to UDDI.

Dec 11, 2015

Download

Documents

Tori Deem
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: Presentation 7: SOAP, WSDL & introduction to UDDI.

Presentation 7:

SOAP, WSDL & introduction to UDDI

Page 2: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 2 af 51

Outline

• Overview of Web Services & SOAP• Service-Oriented Architecture

– Service Description– Service Registration and Discovery– Service Execution

• Emerging Web Services standards:

SOAP, WSDL, UDDI (introduced)

Page 3: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 3 af 51

Web Service Defined

• W3C definition:– [Definition: A Web service is a software system

designed to support interoperable machine-to-machine interaction over a network. It has an interface described in a machine-processable format (specifically WSDL). Other systems interact with the Web service in a manner prescribed by its description using SOAP messages, typically conveyed using HTTP with an XML serialization in conjunction with other Web-related standards.]

Page 4: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 4 af 51

Overview SOAP & Web services

• SOAP – Simple Object Access Protocol - & Web services:

– A light-weight & ultra heterogenic alternative to CORBA, DCOM & RMI

– Openness in focus – meant for opening legacy applications for others

– Not meant in the role of Inter business, large scale, transaction heavy communication (as CORBA & J2EE)

– But can prob. be used for it!– Does not have services for transactions,

concurrency, persistence, scalability– Does have discovery services (UDDI) giving

some degree of location transparency– Does have Interface Definition Language for

heterogeneity (WSDL)– Fails on several of the dist. system

requirements!– But easy to implement yourself!

Page 5: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 5 af 51

Why SOAP When We Have CORBA?

• CORBA has been considered too complex by many– May not be true with new development tools using wizards

• They aim at solving different tasks:– SOAP covers light-weight application integration within the

enterprise, exposing legacy business objects across enterprises, and sharing resources (like Google Search Engine, or Sonofon SMS/MMS API) on the net, as well as technology openness

– CORBA has a wide range of services for (as we shall see later):• Locating, creating & moving objects• Object relationship management between hosts• Persistency services – activation frameworks etc.• Distributed concurrency and transaction management • Security

– Only some are supported in SOAP tech family – its lightweight– Lesson: define your needs – and find the right technology

Page 6: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 6 af 51

Regarding SOAP• SOAP is not by it self revolutionary – its merely:

– a framework for exchanging XML-based information in a network (via protocols of the TCP/IP family) – with RPC capabilities

– the currently most hyped XML / Web service technology • But when combined with other technologies like

– WSDL &– UDDI – It solves several of the requirements of a Distributed System

• And the fact that it is an open standard – supported by all major software vendors and programming languages:– C++– Java– C#– Delphi– Visual Basic and many more

• Makes it somewhat revolutionary! A practical solution – like WWW

Page 7: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 7 af 51

Examples of Web Services

• Google's Web Service - access the Google search engine – http://www.google.com/apis/

• Amazon's Web Service - access Amazon's product information – http://associates.amazon.com/exec/panama/associates/join/

developer/resources.html

• XMethods - collection of information about existing Web services – http://www.xmethods.com

• SalCentral - WSDL / SOAP Web services search-engine – http://www.salcentral.com/salnet/webserviceswsdl.asp

Page 8: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 8 af 51

Google Web Service

Page 9: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 9 af 51

Service-Oriented Architecture (SOA)

ClientClientServerServer

RegistryRegistryAbstract Architecture- Web service stackAbstract Architecture- Web service stack

Legacycode onserver

Legacycode onserver

11 22

33

Opening up for doing business (the sharing of objects) on the Internet

Page 10: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 10 af 51

Technologies for Implementing SOA

SOAP for communicationSOAP for communication WSDL for contract & bindingWSDL for contract & binding

UDDI & WSDL for registration & discoveryUDDI & WSDL for registration & discovery

Page 11: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 11 af 51

SOAP

SOAP is used for Client/Server communications

Page 12: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 12 af 51

What is 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 13: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 13 af 51

What is Not SOAP?

• Not a component model– So it will not replace objects and components, i.e. EJB,

JavaBeans and .NET

• Not a programming language– So it will not replace Java, C# og C++

• Not a solution for all– So it will not replace other distributed computing

technologies such as RMI and CORBA

Page 14: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 14 af 51

Where is SOAP?

• W3C XML Protocol working group– SOAP 1.2 current version:

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

• Microsoft, SUN, Oracle, HP, IBM all support the W3C recommendation– but there are still differences to be overcome– security issues, transactions etc.

Page 15: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 15 af 51

What does SOAP define?

• Message Envelope• Encoding Rules• RPC Convention• Binding with underlying protocols

– HTTP (which we will use in this course)– SMTP– FTP and others

Page 16: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 16 af 51

SOAP Message Format

Possible to Attach binaries (images, cryptographic material) to attachmentsPossible to Attach binaries (images, cryptographic material) to attachments

Page 17: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 17 af 51

SOAP Message Envelope

• Encoding information• Header

– Optional– Could contain context knowledge

• Security• Transaction

• Body– RPC methods and parameters– Contains application data

Page 18: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 18 af 51

Two types of communication

Page 19: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 19 af 51

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 20: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 20 af 51

SOAP RPC Response Example

<SOAP-ENV:Envelopexmlns: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 21: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 21 af 51

SOAP RPC composition I

• Information needed for a method call:1. The URI of the target object (marked with red)

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

<tickerSymbol>SUNW</tickerSymbol>

</m:GetLastTradePrice>

</SOAP-ENV:Body>

Page 22: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 22 af 51

SOAP RPC composition II

• Information needed for a method call:1. The URI of the target object

2. The Method Name

<SOAP-ENV:Body>

<m:GetLastTradePrice xmlns:m=“http://stocks.com/StockQuotes">

<tickerSymbol>SUNW</tickerSymbol>

</m:GetLastTradePrice>

</SOAP-ENV:Body>

Page 23: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 23 af 51

SOAP RPC composition III

• Information needed for a method call:1. The URI of the target object

2. The Method Name

3. Parameters

4. Binding protocol (next slide)

<SOAP-ENV:Body>

<m:GetLastTradePrice xmlns:m=“http://stocks.com/StockQuotes">

<tickerSymbol>SUNW</tickerSymbol>

</m:GetLastTradePrice>

</SOAP-ENV:Body>

Name is not important

Name is not important

Page 24: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 24 af 51

SOAP RPC composition IV: complete SOAP RPC Request

POST /StockQuote HTTP/1.1Host: www.stockquoteserver.comContent-Type: text/xml; charset="utf-8"Content-Length: nnnnSOAPAction: "Some-URI"

<SOAP-ENV:Envelope xmlns:SOAP-ENV=”http://schemas.xmlsoap.org/soap/encoding" SOAP-ENV:encodingStyle=”http://schemas.xmlsoap.org/soap/envelope/">

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

<tickerSymbol>SUNW</tickerSymbol></m:GetLastTradePrice>

</SOAP-ENV:Body></SOAP-ENV:Envelope>

HTTPHTTP

EncodingEncoding

Name-spaceName-space

STEP 4: BINDING TO PROTOCOLSTEP 4: BINDING TO PROTOCOL

Page 25: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 25 af 51

Request to HelloWorld.jws

Input parameters type stringInput parameters type string

HTTP Post CallHTTP Post Call

HTTP Host TargetHTTP Host Target

Method nameMethod name

Page 26: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 26 af 51

… and the HTTP Response from Server

HTTP ResponseHTTP Response

Method ResponseMethod Response

Parameter valueParameter valueParameter nameParameter name

Apache Tomcat Server RespondingApache Tomcat Server Responding

Page 27: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 27 af 51

In addition

• There is:– Response handling– Fault handling

Page 28: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 28 af 51

Lucky us

• Luckly we dont have to understand SOAP– So it does not really matter that it is somewhat complex– Unless we want to develop clients that do not have a

SOAP API– ... But then we need an XML parser … and more …– BUT IT IS POSSIBLE and might be feasible

Page 29: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 29 af 51

How to make a Web service with SOAP

• You need an application or API capable of supporting:– Communication over the Internet (HTTP)– Security (SSL)– XML Parsing capabilities– …

• Two examples of Application Servers with support:– Apache Tomcat Application Server with AXIS– Microsoft Internet Information Server

• JAX-RPC (JSR-101)– Java™ API for XML-based RPC– Need to implement features manually

Page 30: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 30 af 51

Issues with SOAP

• Issues with SOAP– Lack of business semantics– Insufficient functionality for business operations– Security– Reliability– Under development

• Low performance

Page 31: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 31 af 51

WSDL

• WSDL is used for describing WebServices

Page 32: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 32 af 51

What is WSDL?

• XML language for describing web services• Web service is described as

– A set of communication endpoints (ports)

• Endpoint is made of– Abstract definitions of operations and messages– Concrete binding to networking protocol and message

format

Page 33: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 33 af 51

Why WSDL?

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

• Note that WSDL defines only low-level aspects of Web services, however other technologies might follow …– Security– Transactions– Persistency

Page 34: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 34 af 51

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 35: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 35 af 51

WSDL Elements

• Types– Data type definitions– Used to describe exchanged messages– Uses W3C XML Schema as canonical type system

Page 36: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 36 af 51

WSDL Example: Types

Page 37: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 37 af 51

WSDL Elements

• Messages– Abstract, typed definitions of data being exchanged

• Operations– Abstract description of an action– Refers to input and output messages

• Port type– Collection of operations – Resembles a Class in OOPL

Page 38: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 38 af 51

Example:Messages, Operation, Port type

Page 39: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 39 af 51

WSDL Elements

• Binding– Concrete protocol and data format for a particular Port

type– Example: SOAP 1.1, HTTP, MIME

• Port– Defines a single communication endpoint– Address for binding– URL for HTTP, email address for SMTP

• Service– Aggregate set of related ports

Page 40: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 40 af 51

WSDL Elements

Page 41: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 41 af 51

HelloWorld.jws?wsdl

Page 42: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 42 af 51

Tools

• Generate WSDL document from– existing Java classes or EJB components– AXIS: Java2WSDL

• Generate SOAP messages from– WSDL document (via client stub and server skeleton)

• JAX-RPC, Forte for Java, JBuilder, JDeveloper

Page 43: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 43 af 51

UDDI

• UDDI for publishing & discovery – the SOA

Page 44: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 44 af 51

UDDI

• Universel Descrition, Discovery & Integration• UDDI defines a scheme to publish and discover

information about Webservices• Programmatic registration and discovery business

entities and their Webservices• Based on SOAP, HTTP, XML• Registry data

– Business registrations– Service type definitions

Page 45: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 45 af 51

Registration

• “ 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 46: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 46 af 51

What uses UDDI?

• Tool building client (Service Consumer)– Browse or search registry– Create a service proxy

• Tool publishing the service– Generates WSDL– Construct UDDI entries

• Application that needs dynamic binding– Directly access UDDI– Query can be pre-generated

Page 47: Presentation 7: SOAP, WSDL & introduction to UDDI.

SOAP & Web Services in relation to Distributed Objects

Page 48: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 48 af 51

SOAP and Distributed Objects

• SOAP in it self has nothing to do with objects• There probably is SOAP API’s for C and COBOL• The trick is the supporting API’s converting

objects to WSDL and SOAP for serialization across the network

• Using the Proxy Pattern for decoupling – perhaps with the Façade Pattern for larger granularity– Emmerich: Accessing distributed objects is expensive– Use larger granularity

• More on Architecture later in the course

Page 49: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 49 af 51

Proxy Pattern (GoF version)

WatchClient

RealWatchProxyWatch TestWatch

setTime()

setTime() setTime() setTime()

Objects of RealWatch class are locateed on a different machinethan the Client object.This is an example of Remote Proxy – which is anArchitectural Pattern. from GoF

abstract

GoF: Gang Of Four (Design Pattern bog af Gamma m.fl.)

Page 50: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 50 af 51

Proxy Pattern (B. Douglas version)

ClientObject

SOAPProxy

Serverobject

BD.s212

Client component

Server component

Proxy Pattern Client

Server Proxy

Proxy (= en stedfortræder)

By encapsulatingThe SOAP communicationin a Proxy,we have decoupled theClient Object fromneeding to knowthat it calls overThe Internet. Thus making it easyto implementdifferent Middlewareand use the Serverobject locallyWe could do the same for

The Server object

Page 51: Presentation 7: SOAP, WSDL & introduction to UDDI.

Ingeniørhøjskolen i ÅrhusSlide 51 af 51

Façade Pattern (also GoF)

Used for encapsulation and decouplingUsed for encapsulation and decoupling

The entire Client Subsystem is decoupled from the serverand a Client Proxy hides the SOAP implementation (also Server Proxy)

This is known as Client Stubs & Server Skeletons

The entire Client Subsystem is decoupled from the serverand a Client Proxy hides the SOAP implementation (also Server Proxy)

This is known as Client Stubs & Server Skeletons