Se3316a 2013 09 Webservices

79
7/18/2019 Se3316a 2013 09 Webservices http://slidepdf.com/reader/full/se3316a-2013-09-webservices 1/79 SE3316b – Web Technologies Introduction to Web Services Dr. Jagath Samarabandu  [email protected] TEB 351 519-1-!111 "#$$5# %a"& 519-#5$-!'3

description

Webservices

Transcript of Se3316a 2013 09 Webservices

Page 1: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 1/79

SE3316b – Web

TechnologiesIntroduction to Web Services

Dr. Jagath Samarabandu  [email protected]

TEB 351

519-1-!111 "#$$5#

%a"& 519-#5$-!'3

Page 2: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 2/79

SE3316 © Jagath Samarabandu   24-Nov-13

Origin of Web Services

Web started out with the human interaction oftextual and graphical data

This is not quite suitable for machine-to-machineinteraction

Individuals and companies needed to publishlinks to not only their information, but to theirapplications as well

Internet based applications needed to find,access and automatically interact with otherinternet based applications

Page 3: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 3/79

SE3316 © Jagath Samarabandu   34-Nov-13

What is a Web Service

A Web service is an application that accepts XML-formatted requests from other systems across a network via lightweight, vendor-neutral communications

protocols1.

These protocols have been defined bystandards organizations like OASIS and theW3C.

This allows any network-enabled, XML-awareapplication to invoke a Web service, regardlessof the programming language or operatingsystem involved.

Introduction to web services and the WS S() *5.1+ IB, deve-oerWor/s 

Page 4: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 4/79

SE3316 © Jagath Samarabandu   44-Nov-13

Describing Web Services

Web Services architecture is

Distributed Loosely coupled Service oriented

Interface definition is crucial for a service oriented

architecture Described using Web Services Description Language

(WSDL) Defines the contract between client and server

What the service will provide What the client can expect

Page 5: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 5/79

SE3316 © Jagath Samarabandu   54-Nov-13

Connecting Web Services

Loose coupling requires Common format: message payload format Common protocol: message transport

Most common combination is

Format: Simple Object Access Protocol (SOAP) Protocol: Hypertext Transfer Protocol (HTTP)

Other combinations Formats: REST and XML-RPC

Protocols: SMTP and IIOP

Page 6: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 6/79

SE3316 © Jagath Samarabandu   64-Nov-13

Web Service Technologies 1

Extensible Markup Language (XML) Basic foundation

Provides a language for defining data and how toprocess it

Family of related specifications by W3C Web Services Description Language (WSDL)

XML based technology

Defines web services, interfaces, data and messagetypes, interaction patterns and protocol mappings

Page 7: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 7/79

SE3316 © Jagath Samarabandu   74-Nov-13

Web Service Technologies 2

Simple Object Access Protocol (SOAP) A collection of XML based technologies Defines an envelope for Web services communication

Mappable to HTTP and other transports

Provides a serialization format for transmitting XML documents

over a network Provides conventions for representing RPC interactions

Universal Description, Discovery and Integration A Web services registry and discovery mechanism

Used for storing and categorizing business information andretrieving pointers to Web service interfaces

Page 8: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 8/79

SE3316 © Jagath Samarabandu   84-Nov-13

Distributed Computing: Reinventingthe Wheel Shares many characteristics with DCOM, CORBA and

RMI, but DCOM is proprietary RMI is Java specific CORBA is too complicated

Web is well established Web connections are transient Traditional distributed computing typically depends on

transport level connections and are not suitable for atransient connection oriented medium like the Web

Allows “develop now, integrate later” approach (EAI)

Page 9: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 9/79

SE3316 © Jagath Samarabandu   94-Nov-13

The New Silver Bullet

Promises development of servicesimplemented in any language anddeployed on any hardware with any OS

Can it replace the Web, relationaldatabases, 4th generation languages andAI?

In reality, it is just another layer thatprovides an integration mechanism at ahigher level of abstraction

Page 10: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 10/79

SE3316 © Jagath Samarabandu   104-Nov-13

Inter-operability Heaven or Hell?

Web services contain WSDL, SOAP and UDDI

Is it WSDL v1.2, SOAP v1.1 and UDDI v1.0 ?

Or WSDL v1.1, SOAP v1.2 and UDDI v2.0 ?

What about XML, HTTP, TLS/SSL Web Services Inter-operability Organization

(WS-I) was formed to address some of these

problems

Page 11: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 11/79

SE3316 © Jagath Samarabandu   114-Nov-13

WS-I Profiles and Testing

Web services profiles: aggregate collections of

key Web services standards, brought intomeaningful groupings, along with conventionsand best practice guidelines for their usetogether, to simplify implementation and

promote interoperability Web services testing and implementation

guidance: a set tools for self-administered teststo determine conformance to baselinespecifications, aimed at improving interoperationof infrastructure and applications [From WS-Iwebsite]

Page 12: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 12/79

SE3316 © Jagath Samarabandu   124-Nov-13

WS-I Basic Profile 2.0 Finalized on Oct 11, 2010

Simple Object Access Protocol(SOAP) 1.2 (Part 1 & 2) SOAP Message Transmission

Optimization Mechanism (MTOM)

RFC2616: Hypertext TransferProtocol -- HTTP/1.1

RFC2965: HTTP StateManagement Mechanism

Extensible Markup Language(XML) 1.0 (Second Edition)

Namespaces in XML 1.0

XML Schema Part 1: Structures XML Schema Part 2: Datatypes

Web Services DescriptionLanguage (WSDL) 1.1

UDDI Version 2.04 APISpecification, Dated 19 July 2002

UDDI Version 2.03 Data StructureReference, Dated 19 July 2002

UDDI Version 2 XML Schema

RFC2818: HTTP Over TLS RFC2246: The TLS Protocol

Version 1.0 The SSL Protocol Version 3.0 RFC2459: Internet X.509 Public

Key Infrastructure Certificate andCRL Profile

Page 13: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 13/79

SE3316 © Jagath Samarabandu   134-Nov-13

Web Services Architecture

0euester 2roviderbind

0euester 2rovider

(irector

bind

4ind ubish

Page 14: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 14/79

SE3316 © Jagath Samarabandu   144-Nov-13

Web Service Scenarios

Componetized E-service (B2B)

Businesses can purchase access to online services offered byother businesses Service need not be customized for each client

Enterprise Application Integration (EAI) Organizations can wrap their legacy applications in a

standardized format Can migrate gradually to the new messaging architecture

Intra-enterprise component reuse Provides the necessary framework to describe and discover the

existence, interface and location of software componentsthrough WSDL and UDDI

Page 15: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 15/79

SE3316 © Jagath Samarabandu   154-Nov-13

XML in Web Services

All aspects of Web services are built on XML How data is generically represented

How and with what qualities of service the data istransmitted

How the services are published and discovered Web service implementations decode these

various bits of XML to interact with variousapplications and software domains underneaththe services

Page 16: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 16/79

SE3316 © Jagath Samarabandu   164-Nov-13

Web Service Technologies WSDL (Web Service Description Language)

Language for describing network services WSDL descriptions of capabilities and locations of services Like an interface description language for Web services Communication using SOAP or direct HTTP

SOAP (Simple Object Access Protocol) Framework for exchanging information in a network Not so simple now (specs at 500 pages and growing)

UDDI (Universal Description, Discovery, and Integration) provides a registry mechanism for clients and servers to find

each other uses SOAP for communication

Page 17: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 17/79

SE3316 © Jagath Samarabandu   174-Nov-13

WSDL Basics

Developed collaboratively by IBM,Microsoft and Ariba. Now joined by a largenumber of participants

Both parties to a web service interactionneed copies of the same WSDL file

WSDL is used to both describe web

services and locate web services Typically WSDL files are generated by

web service-aware tools

Page 18: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 18/79

SE3316 © Jagath Samarabandu   184-Nov-13

What is WSDL?

WSDL describes a Web service in two

fundamental stages: one abstract and oneconcrete. At an abstract level, WSDL describes a Web

service in terms of the messages it sends andreceives; messages are described independentof a specific wire format using a type system,typically XML Schema.

Defined in WSDL 2.0 using operations,interfaces, bindings and services.

Page 19: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 19/79

SE3316 © Jagath Samarabandu   194-Nov-13

WSDL Components An operation associates a message exchange pattern

with one or more messages. An interface (called porttype in 1.1) groups together

operations without any commitment to transport or wireformat.

At a concrete level, a binding specifies transport andwire format details for one or more interfaces. Anendpoint associates a network address with a binding.

A service groups together endpoints that implement acommon interface.

- WSDL 2.0 Specification

Page 20: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 20/79

SE3316 © Jagath Samarabandu   204-Nov-13

WSDL Document Structure

A WSDL document defines a web services using

three categories of elements: Content and data types of messages

Operations performed by messages

Specific protocol bindings for exchanging messages These categories can be combined or re-used

once defined

Within these categories, there is a collection ofelements (or parts)

Page 21: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 21/79

SE3316 © Jagath Samarabandu   214-Nov-13

WSDL Layers

Service definition layer describes abstract

properties: data typesmessage types operations services

Binding layer describes concrete properties: protocols

data formats (using SOAP, HTTP, MIME)

Page 22: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 22/79

SE3316 © Jagath Samarabandu   224-Nov-13

Seven Elements of WSDL (1.1)

Types

Data types in the form of XML schemas or other mechanisms Message

An abstract definition of data in the form of a message presentedeither as an entire document or as arguments to be mapped to a

method invocation Operation

The abstract definition of the operation for a message, such asnaming a method, message queue or business process, that willaccept and process the message

Page 23: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 23/79

SE3316 © Jagath Samarabandu   234-Nov-13

7 WSDL Elements … contd. Port Type

An abstract set of operations mapped to one or more endpoints,defining the collection of operations for a binding

Binding The concrete protocol and data formats for the operations and

messages defined for a given port type

Port A combination of a binding and a network address, providing the

target address of the service communication

Service

A collection of related endpoints encompassing the servicedefinitions that maps the bindings to the port

Page 24: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 24/79

SE3316 © Jagath Samarabandu   244-Nov-13

WSDL Concepts by Example

Shopping Cart

Add

Remove

List

Operation

WSDL Terms

Port Type

Page 25: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 25/79

SE3316 © Jagath Samarabandu   254-Nov-13

Shopping Cart Service

Service

WSDL Concepts by Example

Shopping Cart

Add

Remove

List

WSDL Terms

Operation

Port Type

HTTP

SOAP

HTTP

XML

Bindinghttp://myservice.net/soap/cart

http://myservice.net/cart

Port

Page 26: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 26/79

SE3316 © Jagath Samarabandu   264-Nov-13

WSDL Concepts by Example

Shopping Cart Service

Shopping Cart

Add

Remove

List

HTTP

SOAP

Operation

ServiceHTTP

XML

Binding

Port Type

WSDL Terms

<soap:envelope …>

<soap:body>

<soap:fault>

<faultcode>…

<faultstring> …

</soap:fault>

<soap:body>

<soap:envelope>

Fault

<soap:envelope …>

<soap:body><soap:fault>

<faultcode>…

<faultstring> …

</soap:fault>

<soap:body>

<soap:envelope>

Fault

<soap:envelope …>

<soap:body><soap:fault>

<faultcode>…

<faultstring> …

</soap:fault>

<soap:body>

<soap:envelope>

Faults

Message

AddItemInput

AddItemOutput

Port

Page 27: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 27/79

SE3316 © Jagath Samarabandu   274-Nov-13

Structure of a WSDL Document

<definitions>

<types> XML Schema element and type definitions</types>

<message>One or more named parts typed by XMLSchema elements </message>

<portType> Describing a set of operations </portType><binding>Selects communication protocol and data

formats for each operation and message </binding>

<service>describes a collection of named ports, eachassociated with a binding and a network address

</service>

</definitions>

Page 28: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 28/79

SE3316 © Jagath Samarabandu   284-Nov-13

WSDL: Describing Things

<definitions name=“ShoppingCartDefinitions”

xmlns=“http://schemas/xmlsoap.org/wsdl” targetNamespace= … ><types> … </types>

<message name=“AddItemInput”> … </message>

<message name=“AddItemOutput”> … </message>

<portType name=“ShoppingCart”> … </portType><binding name=“CartHTTPXMLBinding” type=“tns:ShoppingCart”>…

<binding name=“CartSOAPBinding” type=“tns:ShoppingCart”>…

<service name=“ShoppingCartService”>

<port name=“HTTPXMLCart” binding=“tns:CartHTTPXMLBinding”>…<port name=“SOAPCart” binding=“tns:CartSOAPBinding”> …

</service>

<import namespace=“…” location=“…”>

</definitions>

Page 29: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 29/79

SE3316 © Jagath Samarabandu   294-Nov-13

WSDL: Describng Port Types

A named collection of related operations

<portType name=“ShoppingCart”>

<operation name=“AddItem”> … </operation>

<operation name=“RemoveItem”> … </operation><operation name=“ListItems”> … </operation>

</portType> Shopping Cart

Add

Remove

List

Page 30: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 30/79

SE3316 © Jagath Samarabandu   304-Nov-13

WSDL: Describing Operations

A signature (input, output and fault messages)

Operations can be one-way, request-response,notifications or solicit-response

<operation name=“AddItem”><input message=“tns:AddItemInput”/>

<output message=“tns:ACK”/>

<fault name=“BadCartID” message=“tns:BadCartID”/>

<fault name=“ServiceDown” message=“tns:ServiceDown”/>

</operation>

Add

Page 31: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 31/79

SE3316 © Jagath Samarabandu   314-Nov-13

WSDL: Describing Messages

A named collection of message parts

Each part has a name and a type

<message name=“AddItemInput”>

<part name=“cart-id” type=“xsd:string”/>

<part name=“item” type=“carttypes:item”/>

<part name=“image” type=“xsd:base64Binary”/>

</message>

Page 32: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 32/79

SE3316 © Jagath Samarabandu   324-Nov-13

WSDL: Describing Data Types

Using the XML Schema language

<types>

<schema targetNamespace=“http://myservice.net/cart/types”

xmlns=“http://www.w3.org/2000/10/XMLSchema”>

<complexType name=“item”><all>

<element name=“description” type=“xsd:string”/>

<element name=“quantity” type=“xsd:integer”/>

<element name=“price” type=“xsd:float”/></all></complexType>

</schema>

</types>

Page 33: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 33/79

SE3316 © Jagath Samarabandu   334-Nov-13

WSDL: Describing Bindings

A named association of protocol details with a port type,its operations and its messages

<binding name=“CartHTTPXMLBinding”type=“tns:ShoppingCart”>

<http:binding verb=“POST”/><operation name=“AddItem”>

<http:operation location=“/AddItem”/><input> <mime:mimeXML/> </input><output> <mime:mimeXML/> </output>

<fault name=“BadCartID”> <mime:mimeXML/> </fault><fault name=“ServiceDown”> <mime:mimeXML/> </fault>

</operation> …</binding> HTTP

XML

Page 34: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 34/79

SE3316 © Jagath Samarabandu   344-Nov-13

WSDL Example: Bindings<binding name=“CartHTTPSOAPBinding” type=“tns:ShoppingCart”>

<soap:binding style=“RPC” transport=“http://schemas.xmlsoap.org/soap/http”/>

<operation name=“AddItem”>

<soap:operation soapAction=“http://myservice.net/cart/AddItem”/>

<input>

<soap:body use=“encoded” namespace=“http://myservice.net/cart”

encodingStyle=“http://schemas.xmlsoap.org/soap/encoding”/></input>

<output>

<soap:body use=“encoded” namespace=“http://myservice.net/cart”

encodingStyle=“http://schemas.xmlsoap.org/soap/encoding”/>

</output><fault name=“BadCartID”> <soap:body use=“encoded” namespace= … /></fault>

<fault name=“ServiceDown”> <soap:body use= … /> </fault></operation> …

</binding>

SOAP

XML

Page 35: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 35/79

SE3316 © Jagath Samarabandu   354-Nov-13

WSDL: Describing Ports

A named association of a protocol bindingwith a network address

<port name=“SOAPCart” binding=“tns:SOAPCartBinding”>

<soap:address location=“http://myservice.net/soap/cart”/></port>

<port name=“HTTPXMLCart”binding=“tns:HTTPXMLCartBinding”>

<http:address location=“http://myservice.net/cart”/></port>

HTTP

SOAP

HTTP

XML

http://myservice.net/soap/cart

http://myservice.net/cart

Page 36: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 36/79

SE3316 © Jagath Samarabandu   364-Nov-13

How WSDL Describes: Services

A related collection of ports

<service name=“ShoppingCartService”>

<documentation>A Shopping Cart for the Web</documentation>

<port name=“HTTPXMLCart” binding=“tns:HTTPXMLCartBinding”><http:address location=“http://myservice.net/cart”/>

</port>

<port name=“SOAPCart” binding=“tns:SOAPCartBinding”>

<soap:address location=“http://myservice.net/soap/cart”/></port>

</service>

Page 37: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 37/79

SE3316 © Jagath Samarabandu   374-Nov-13

WSDL: Describing Reuse<import namespace=“http://webservices.org/cart/cart-type”

location=“http://services.org/cart/cart-type.wsdl”/><binding xmlns:ws=“http://webservices.org/cart/cart-type”

name=“CartHTTPXMLBinding” type=“ws:ShoppingCart”>…

http://xml.org/shopping/items.xsd

Shopping Cart

Add

Remove

ListAddItemInput

AddItemOutput

Shopping CartAddRemove

List

<soap:envelope …>

<soap:body>

<soap:fault>

<faultcode>…<faultstring> …

</soap:fault>

<soap:body>

<soap:envelope>

http://webservices.org/cart/cart-type.wsdl

Shopping Cart Service

http://myservice.net/cart/cart.wsdl

HTTP

SOAP

HTTP

XML

http://myservice.net/soap/cart

http://myservice.net/cart

Page 38: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 38/79

SE3316 © Jagath Samarabandu   384-Nov-13

Example of a WSDL Section

<message name="getTermRequest">

<part name="term" type="xs:string"/></message>

<message name="getTermResponse">

<part name="value" type="xs:string"/></message>

<portType name="glossaryTerms"><operation name="getTerm">

<input message="getTermRequest"/><output message="getTermResponse"/>

</operation></portType>

Example C function

getTerm(char *getTermRequest,char *getTermResponse

)

Page 39: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 39/79

SE3316 © Jagath Samarabandu   394-Nov-13

WSDL Ports Defines a web service, the operations that can

be performed, and the messages that areinvolved.

The port defines the connection point to a web

service. It can be compared to a function library (or a

module, or a class) in a traditional programminglanguage.

Each operation can be compared to a function ina traditional programming language.

Page 40: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 40/79

SE3316 © Jagath Samarabandu   404-Nov-13

Operation Types WSDL defines four operation types:

One-way: The operation can receive a message butwill not return a response

Request-response: The operation can receive arequest and will return a response

Solicit-response: The operation can send a requestand will wait for a response

Notification: The operation can send a message butwill not wait for a response

The request-response type is the most commonoperation type

Page 41: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 41/79

SE3316 © Jagath Samarabandu   414-Nov-13

One-Way Operation Example<message name="newTermValues">

<part name="term" type="xs:string"/><part name="value" type="xs:string"/>

</message>

<portType name="glossaryTerms">

<operation name="setTerm"><input name="newTerm“

message="newTermValues"/></operation>

</portType >

- Example from w3schools.com

Page 42: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 42/79

SE3316 © Jagath Samarabandu   424-Nov-13

Request-Response Example<message name="getTermRequest">

<part name="term" type="xs:string"/></message>

<message name="getTermResponse"><part name="value" type="xs:string"/>

</message>

<portType name="glossaryTerms"><operation name="getTerm">

<input message="getTermRequest"/><output message="getTermResponse"/>

</operation></portType>

Page 43: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 43/79

SE3316 © Jagath Samarabandu   434-Nov-13

WSDL Binding Element The binding element has two

attributes name: name of the binding type: port for binding

soap:binding element has twoattributes –  style: "rpc" or "document"

transport: SOAP protocol The operation element defines

each operation that the portexposes.

For each operation the

corresponding SOAP actionhas to be defined.

<binding type="glossaryTerms"name="b1">

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

soap/http" />

<operation><soap:operation

soapAction="http://example.com/getTerm"/>

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

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

</output></operation>

</binding>

Page 44: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 44/79

SE3316 © Jagath Samarabandu   444-Nov-13

WSDL Port2ort

2ort Te

eration 6 ,essage 6 7inut8

,essage B 7outut8

eration B,essage 7outut8

Binding 1 Binding ! Binding 3

:etwor/ 6ddresses

Page 45: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 45/79

SE3316 © Jagath Samarabandu   454-Nov-13

Service

WSDL Service

2ort

2ort Te

eration

Binding Binding Binding

:etwor/ 6ddresses

eration

eration

2ort

2ort Te

eration

Binding Binding Binding

:etwor/ 6ddresses

eration

eration

2ort

2ort Te

eration

Binding Binding Binding

:etwor/ 6ddresses

eration

eration

Page 46: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 46/79

SE3316 © Jagath Samarabandu   464-Nov-13

Other WDSL Bindings HTTP

Selects GET or POST method Absolute URI for each port

Relative URI for each operation

Optionally, encoding of request message parts (URL encoding,URL replacement)

MIME Specifies MIME types for message parts (text/xml,

multipart/related, ...)

Only describes data formats, needs SOAP/HTTP binding tospecify communication protocol

Page 47: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 47/79

SE3316 © Jagath Samarabandu   474-Nov-13

HTTP/MIME Binding Example

<binding name="binding“ type="tns:widgetPortType"><http:binding verb="POST"/>

<operation name="getGadgetInfo">

<http:operation location="getGadgetInfo"/>

<input><mime:content type="application/x-www-form-urlencoded"/> </input>

<output><mime:mimeXml/> </output>

</operation>

<operation name="setGadgetInfo">

<http:operation location="setGadgetInfo"/>

<input><mime:multipartRelated>

<mime:part><mime:content part="id" type="text/plain"/> </mime:part>

<mime:part> <mime:mimeXml part="info"/> </mime:part>

</mime:multipartRelated></input>

<output><mime:content type="text/plain"/></output>

</operation>

</binding>

Page 48: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 48/79

SE3316 © Jagath Samarabandu   484-Nov-13

WSDL Related Namespaces

WSDL Framework

http://schemas.xmlsoap.org/wsdl

WSDL bindings for SOAP

http://schemas.xmlsoap.org/wsdl/soap HTTP GET and POST bindings

http://schemas.xmlsoap.org/wsdl/http

MIME bindings

http://schemas.xmlsoap.org/wsdl/mime

Page 49: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 49/79

SE3316 © Jagath Samarabandu   494-Nov-13

WSDL Namespaces … contd.

SOAP 1.1 encoding and envelope

http://schemas.xmlsoap.org/soap/encoding

http://schemas.xmlsoap.org/soap/envelope

XML schema namespacehttp://www.w3.org/2001/XMLSchema

tns – the namespace prefix used by

convention to refer to the currentdocument

Page 50: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 50/79

SE3316 © Jagath Samarabandu   504-Nov-13

WSDL Shortcomings HTTP and MIME bindings are too loosely specified

Not all WSDL documents "make sense" Which extension elements may/must be specified? How are message parts ordered and identified in a response? Can XML input be transmitted with urlReplacement?

WSDL is too closely tied with SOAP Solicit-response and notification are not supported by

any existing binding More complex interaction patterns cannot be described

(e.g. transactions)

WSDL is too closely tied with XML Schema

Page 51: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 51/79

SE3316 © Jagath Samarabandu   514-Nov-13

Web Service Technologies WSDL (Web Service Description Language)

Language for describing network services WSDL descriptions of capabilities and locations of services

Like an interface description language for Web services

Communication using SOAP or direct HTTP

SOAP (Simple Object Access Protocol) Framework for exchanging information in a network

Not so simple now (specs at 500 pages and growing)

UDDI (Universal Description, Discovery, and Integration)

provides a registry mechanism for clients and servers to findeach other

uses SOAP for communication

Page 52: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 52/79

SE3316 © Jagath Samarabandu   524-Nov-13

Web Resources SOAP Primer

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

Interactive web services with Java

http://www.brics.dk/~amoeller/WWW/webservices/ind

ex.html SOAP Tutorial

http://www.w3schools.com/soap/default.asp

REST http://tomayko.com/writings/rest-to-my-wife

Page 53: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 53/79

SE3316 © Jagath Samarabandu   534-Nov-13

What is SOAP? SOAP is fundamentally a stateless, one-way message

exchange paradigm for XML-based information Applications can create complex interactions by combining such

one way interactions

Typical message exchange styles:

Document-style (one-way XML messages) RPC (Remote Procedure Call, request-response)

Typical protocol bindings: HTTP/HTTPS (not the same as the HTTP binding for WSDL!)

SMTP (Simple Mail Transport Protocol) Alternatives to SOAP: XML-RPC, REST

Page 54: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 54/79

SE3316 © Jagath Samarabandu   544-Nov-13

What SOAP is not SOAP does not specify

The semantics of any application-specific data it conveys, How SOAP messages are routed

How to achive reliable data transfer

How to traverse firewalls

SOAP provides the framework by which application-specific information may be conveyed in an extensiblemanner.

SOAP also provides a full description of the required

actions taken by a SOAP node on receiving a SOAPmessage.

Page 55: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 55/79

SE3316 © Jagath Samarabandu   554-Nov-13

What SOAP Needs SOAP sends an XML message via HTTP request and

receives a reply (if any) via HTTP response The HTTP listener must provide a SOAP processor

E.g. Apache Axis project

Thus, the HTTP listener must provide XML processing

capability Be able to validate SOAP documents

Be able to understand SOAP documents

SOAP processors run on SOAP nodes

SOAP interactions are modeled as those between SOAP nodes A SOAP node supports one or more SOAP processors

SOAP processor hands off the request to the application

Page 56: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 56/79

SE3316 © Jagath Samarabandu   564-Nov-13

Syntax Rules (SOAP 1.2) A SOAP message MUST

Be encoded using XML Use SOAP envelope namespace

Use SOAP encoding namespace

A SOAP message MUST NOT

Contain a DTD reference Contain XML processing instructions

Namespaces refer to http://www.w3.org/2003/05/soap-envelope

http://www.w3.org/2003/05/soap-encoding http://www.w3.org/2003/05/soap-rpc

Choice of namespace prefixes is arbitrary and not significant

Page 57: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 57/79

SE3316 © Jagath Samarabandu   574-Nov-13

SOAP Message Structure A SOAP message is an ordinary XML

document containing the followingelements: A required Envelope element that identifies

the XML document as a SOAP message

An optional Header element that contains

header information A required Body element that contains call

and response information

An optional Fault element that provides

information about errors that occurred whileprocessing the message

Enveoe

;eader<

Bod<

%aut

Page 58: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 58/79

SE3316 © Jagath Samarabandu   584-Nov-13

SOAP Skeleten Message<?xml version="1.0"?>

<soap:Envelope

xmlns:soap="http://www.w3.org/2003/05/soap-envelope"

soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding">

<soap:Header> ... </soap:Header>

<soap:Body>

...

<soap:Fault> ... </soap:Fault>

</soap:Body>

</soap:Envelope>

Page 59: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 59/79

SE3316 © Jagath Samarabandu   594-Nov-13

SOAP Envelope Element The required SOAP Envelope element is the

root element of a SOAP message It defines the XML document as a SOAP

message It must use the proper envelope namespace Encoding namespace defines complex

structures such as arrays and structs Also references simple types from XML schema

Envelope element is a packaging mechanismthat indicates the start and end of a SOAPmessage

Page 60: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 60/79

SE3316 © Jagath Samarabandu   604-Nov-13

SOAP Header Element Optional

Intended to include additional features andfunctionality Security Transactions

QoS Attributes Loosely defined

For extensions to be meaningful, they must bestandardized

Application specific information can just as be sent inthe body

Page 61: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 61/79

SE3316 © Jagath Samarabandu   614-Nov-13

SOAP Body ElementMandatory element that contains the actual SOAP message

SOAP Request

<?xml version="1.0"?><soap:Envelope xmlns:soap=“…“

soap:encodingStyle=“…">

<soap:Body><m:GetPrice xmlns:m="http://fruits.com/prices">

<m:Item>Apples</m:Item></m:GetPrice>

</soap:Body></soap:Envelope>

S62 0esonse

<?xml version="1.0"?>

<soap:Envelope xmlns:soap=“…“soap:encodingStyle=“…">

<soap:Body><m:GetPriceResponse xmlns:m="http://fruits.com/prices">

<m:Price>1.90</m:Price>

</m:GetPriceResponse></soap:Body>

</soap:Envelope>

Page 62: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 62/79

SE3316 © Jagath Samarabandu   624-Nov-13

SOAP Fault Element Optional fault element is used to hold error and

status information for a SOAP message Must only appear once in the body element

Sub-elements

<faultcode> - A code for identifying the fault

<faultstring> - A human readable explanation of thefault

<faultactor> - Who caused the fault to happen <detail> - Application specific error information related

to the Body element

Page 63: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 63/79

SE3316 © Jagath Samarabandu   634-Nov-13

Fault Codes VersionMismatch

Found an invalid namespace for the SOAP Envelope element

MustUnderstand An immediate child element of the Header element, with the

mustUnderstand attribute set to "1", was not understood

Client The message was incorrectly formed or contained incorrect

information

Server

There was a problem with the server so the message could notproceed

Page 64: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 64/79

SE3316 © Jagath Samarabandu   644-Nov-13

Remote Procedure CallsTo invoke a SOAP RPC, the following information is needed

1. The address of the target SOAP node.

2. The procedure or method name.

3. The identities and values of any arguments together with anyoutput parameters and return value.

4. A clear separation of the arguments used to identify the Web

resource which is the actual target for the RPC, as contrasted withthose that convey data or control information used for processingthe call by the target resource.

5. The message exchange pattern which will be employed to conveythe RPC, together with an identification of the so-called "Web

Method" to be used.6. Optionally, data which may be carried as a part of SOAP header

blocks.

SOAP RPC Request

<?xml version='1.0' ?>

Page 65: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 65/79

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

<env:Header><t:transaction

xmlns:t="http://thirdparty.example.org/transaction"env:encodingStyle="http://example.com/encoding"env:mustUnderstand="true" > 5

</t:transaction></env:Header><env:Body>

<m:chargeReservation env:encodingStyle="http://www.w3.org/2003/05/soap-encoding"xmlns:m="http://travelcompany.example.org/ ">

<m:reservation xmlns:m="http://travelcompany.example.org/reservation"><m:code>FT35ZBQ</m:code></m:reservation>

<o:creditCard xmlns:o="http://mycompany.example.com/financial"><n:name xmlns:n="http://mycompany.example.com/employees"> Åke Jógvan Øyvind 

</n:name><o:number>123456789099999</o:number><o:expiration>2005-02</o:expiration></o:creditCard> </m:chargeReservation> </env:Body> </env:Envelope>

Page 66: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 66/79

SE3316 © Jagath Samarabandu   664-Nov-13

SOAP HTTP Binding SOAP Specification allows binding to any

type of transport mechanism HTTP is the most widely used

Only one specified by the current version A SOAP method is an HTTP

request/response that complies with the

SOAP encoding rules.

HTTP + XML = SOAP

Page 67: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 67/79

SE3316 © Jagath Samarabandu   674-Nov-13

SOAP – HTTP Usage A SOAP request could be

an HTTP POST or an

HTTP GET request. The HTTP POST request

specifies at least twoHTTP headers: Content-Type and Content-Length

Content-Type must be“application/soap+xml”

Standard HTTP statuscodes are used. E.g. 2xx

series for success and4xx series for any faultmessages

HTTP POST Example

POST /Reservations HTTP/1.1

Host:travelcompany.example.org

Content-Type:application/soap+xml;charset= "utf-8"

Content-Length: nnnn<?xml version='1.0' ?>

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

<env:Header>…

</env:Envelope>

HTTP – GET ExampleHTTP GET Request

Page 68: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 68/79

q

GET /travelco.example.org/reservations?code=FT35ZBQHTTP/1.1

Host: travelco.example.org

 Accept: text/html;q=0.5, application/soap+xml

HTTP GET ResponseHTTP/1.1 200 OK

Content-Type: application/soap+xml; charset="utf-8"

Content-Length: nnnn

<?xml version='1.0' ?>

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

<env:Header>

Page 69: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 69/79

SE3316 © Jagath Samarabandu   694-Nov-13

Web Service Technologies WSDL (Web Service Description Language)

Language for describing network services

WSDL descriptions of capabilities and locations of services

Like an interface description language for Web services

Communication using SOAP or direct HTTP

SOAP (Simple Object Access Protocol) Framework for exchanging information in a network

Not so simple now (specs at 500 pages and growing)

UDDI (Universal Description, Discovery, and Integration)

provides a registry mechanism for clients and servers to findeach other

uses SOAP for communication

Page 70: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 70/79

SE3316 © Jagath Samarabandu   704-Nov-13

UDDI

RegistryWSDL

Web

ServiceSOAP

Service

Consumer

Points to description

Describes

ServiceFinds

Service

Communicates withXML Messages

Web Services Technologies

Page 71: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 71/79

SE3316 © Jagath Samarabandu   714-Nov-13

What is UDDI"Universal Description, Discovery and

Integration (UDDI) is a specification fordistributed Web-based information registriesof Web services. UDDI is also a publicly

accessible set of implementations of thespecification that allow businesses to registerinformation about the Web services they offer

so that other businesses can find them."

UDDI Technical White Paper, Sept. 6, 2000, available from www.uddi.org.[Composed by Ariba, IBM, Microsoft]

Page 72: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 72/79

SE3316 © Jagath Samarabandu   724-Nov-13

UDDI Universal Description, Discovery and Integration

Developed by UDDI.org Now a part of OASIS (Organization for the

Advancement of Structured Information – separatefrom W3C)

A registry for Web services

Helps you find a Web service and its description

(WSDL) Search by business

Search by service type

Page 73: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 73/79

SE3316 © Jagath Samarabandu   734-Nov-13

What UDDI Is UDDI is a technical discovery service.

Locates information about services exposed by a partner (andlocate potential partners).

Finds whether a partner's service is compatible with technologiesused by an inquiring business and discover technical parametersso parameters in client applications can be set.

Provides links to the specifications of Web services so that aninquiring business can build an integration layer to the service.

"Complements existing online marketplaces and searchengines by providing them with standardized formats for

programmatic business and service discovery."

Page 74: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 74/79

SE3316 © Jagath Samarabandu   744-Nov-13

What UDDI Is Not UDDI is not a full discovery service that

wouldLocate provider of a specific service in a

specific geographic area within a specific

timeframe.

This business negotiation service can bebuilt upon a UDDI foundation.

Page 75: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 75/79

SE3316 © Jagath Samarabandu   754-Nov-13

UDDI.org Entity defining the UDDI specifications

Partnership among industry leaders

A project to encourage interoperability and

adoption of Web ServicesStandards-based specifications for service

description and discovery

Page 76: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 76/79

SE3316 © Jagath Samarabandu  76

4-Nov-13

UDDI Working Group Accenture

Ariba Commerce One

Compaq

Fujitsu

Hewlett-Packard

i2

Intel

IBM Microsoft

Oracle

SAP

Sun

Verisign

Page 77: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 77/79

SE3316 © Jagath Samarabandu  77

4-Nov-13

UDDI Versions UDDI V1 – Final June 2001

UDDI V2 – Draft June 2001 Adds custom categorizations, business associations,

better query

UDDI V3.0.1 – October 2003

Adds security, internationalization, better query,subscriptions, notifications, and cross-registryreferences

UDDI V3.0.2 – February 2005

Adds URI as identifiers, digital signatures, combiningmulti-step queries to a single complex query andnesting sub queries within a single query

Page 78: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 78/79

SE3316 © Jagath Samarabandu  78

4-Nov-13

UDDI Shortcomings Centered around programmatic access

No provision for service availability checks

No mechanism for community feedback

Neglects other aspects such asnegotiations on pricing, service levelagreements, terms and conditions

Is UDDI dead?

Page 79: Se3316a 2013 09 Webservices

7/18/2019 Se3316a 2013 09 Webservices

http://slidepdf.com/reader/full/se3316a-2013-09-webservices 79/79

SE3316 © Jagath Samarabandu  79

4-Nov-13

Resources Uddi.org

www.ibm.com/services/uddi