what is wsdl?

Post on 01-Jan-2016

38 Views

Category:

Documents

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

T-110.5140 Network Application Frameworks and XML Web Services and WSDL 28.3.2006 Sasu Tarkoma Based on slides by Pekka Nikander. What is WSDL?. WSDL: Web Service Description Language An XML language used to describe and locate web services location of web service methods that are available - PowerPoint PPT Presentation

TRANSCRIPT

T-110.5140 Network Application Frameworks and XML

Web Services and WSDL

28.3.2006

Sasu Tarkoma

Based on slides by Pekka Nikander

What is WSDL?

WSDL: Web Service Description Language An XML language used to describe and locate

web services location of web service methods that are available data type information and XML messages

Commonly used to describe SOAP-based services

W3C standard (work in progress) Initial input: WSDL 1.1 as W3C Note Current version 2.0 (Candidate Recommendation) Some differences between 1.1 and 2.0

WSDL 1.1 in WS-I Basic Profile 1.0 and 1.1.

WSDL Document Elements (v.1.1.)

<types> - data type definitions <message> - Abstract definition of the data

being transmitted <portType> - A set of abstract operations <binding> - Concrete protocol and data

format specifications for the operations and messages defined by a particular portType. Endpoint type.

<port> - An address for binding. Endpoint instance.

<service> - A set of ports.

WSDL Overview

<definitions>: ROOT WSDL element

<types>: The data types that are used<types>: The data types that are used

<message>: What messages are transmitted?<message>: What messages are transmitted?

<portType>: The supported operations<portType>: The supported operations

<binding>: The binding to concrete protocols<binding>: The binding to concrete protocols

<service>: Reference to actual location<service>: Reference to actual location

A WSDL Document

A WSDL document contains two parts Abstract part

Interfaces, types, messages Concrete part

Binding to conrete protocol and encoding May be published separately

Interfaces agreed between many companies Each company published their own

implementation in UDDI and import the abstract interface.

6 of 20

Mapping SOAP to WSDL

Message Styles

The WSDL 1.1 specification defines two SOAP message styles

Determined in binding Document

<soap:Body> contains one or more child elements called parts

There are no SOAP formatting rules for what the <soap:Body> contains

preferred, loose coupling, easy validation RPC

<soap:Body> contains an element with the name of the method or remote procedure being invoked

This element in turn contains an element for each parameter of the procedure

less popular today, tighter coupling

The main structure (v.1.1)

<definitions namespace = "http://.."> <types>XML Schema types</types>

<message>..</message> <portType>a set of operations</portType> <binding>Communication protocols</binding> <service>A list of binding and ports</service>

</definitions>

Types

<types> define data types used in message declaration

For platform neutrality, WSDL uses XML Schema syntax to define data XML Schema must be supported by any

vendor of WSDL conformant products Other kinds of type definitions also possible

Possible interoperability issues If the service uses only XML Schema built-in

simple types, such as strings and integers, the types element is not required

WSDL Messages

The <message> element defines the data elements of an operation the name of the message contains zero or more message part elements

The parts can be compared to the parameters of a function call in a traditional programming language

All parts are typed by an XML Schema type

V.2.0 changes: message element is not used, replaced by patterns

WSDL Ports

The <portType> element is the most important WSDL element

The operations that can be performed, the messages that are involved

A <port> defines the connection point to a web service, an instance of <portType>

It can be compared to a function library (or a module, or a class) in a programming language

Operation Types (v.1.1)

One-Way: The operation can receive a message but will not return a response

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

Solicit-Response: The endpoint sends an output message and then receives an input message.

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

v.2.0 changes: abstract message patterns

<message name="GetLastTradePriceInput"><part name="body" element="TradePriceRequest"/>

</message>

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

</message>

<message name=”ExampleInteraction"><part name="index" type="xsd:integer"/><part name="name" type="xsd:string" />

</message>

Example

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

</portType>

One way and Notification Example

<portType name="RegisterPort"><operation name="register"> <input name="customerInfo" message="RegInfo"/></operation>

<operation name="registerResponse"> <output name="response" message="ResponseInfo"/>

</operation></portType>

Putting it together

Source: http://msdn.microsoft.com/

WSDL 2.0

3 specifications Part 1: Core

Abstract interfaces, independent of protocol and encoding

Part 2: Message Exchange Patterns Predefined types of interactions

Part 3: Bindings SOAP and HTTP/MIME binding

Lot’s of changes from 1.1

Changes from 1.1 to 2.0

Adding further semantics to the description language.

Removal of message constructs. These are specified using the XML schema type system in the types element.

No support for operator overloading. PortTypes renamed to interfaces. Support for

interface inheritance is achieved by using the extends attribute in the interface element.

Ports renamed to endpoints. Abstracted message patterns

WSDL 2.0 Conceptual Model

Source: http://webservices.xml.com/pub/a/ws/2004/05/19/wsdl2.html

Message Exchange Patterns

MEP

in-only

robust-in-only

In-out

out-only

robust-only-out

out-in

out-optional-in

Description

Single input message

Output followed by an opt. Input

Input message + output message

Single output message

Single output message

Output followed by input msg

Single input message

Fault

No

Trigger

Replace

No

Trigger

Replace

Trigger

in-optional-out Input followed by an opt. Output Trigger

Implementations

Microsoft .NET SOAP 1.1, WSDL 1.1

Java API for XML-based RPC (JAX-RPC) SOAP 1.1, WSDL 1.1

Java API for XML Registries (JAXR) Apache Axis

Tools for automatically creating WSDL to/from Java

SOAP 1.1 and 1.2, WSDL 1.1, JAX-RPC 1.0 Axis2 supports WSDL 2.0 component model

IBM Websphere, BEA Web Logic, SAP NetWeaver, …

Uses of WSDL documents

Description of service interfaces Compile-time

Developer uses WSDL before service deployment

Run-time Client downloads WSDL description and uses

the info it provides to execute the service As a side-effect

Developers can use WSDL to speed up the development of code

WSDLJava code Java interfaces WSDL

Summary

Deferred binding, using Web, composition Some details and conventions still unclear

Possible interoperability issues Parts hard to understand

Namespaces Schemas Differences between versions Document vs. RPC SOAP style

Also literal vs. encoded More about this next week

top related