WSDL Web Service Description Language - PowerPoint PPT Presentation

1 / 25
About This Presentation
Title:

WSDL Web Service Description Language

Description:

import namespace= 'http://nesc.ac.uk' location= 'http://nesc.ac.uk/ez.xsd' ... A message is required to pass the return value out ... – PowerPoint PPT presentation

Number of Views:28
Avg rating:3.0/5.0
Slides: 26
Provided by: fab67
Category:

less

Transcript and Presenter's Notes

Title: WSDL Web Service Description Language


1
WSDL Web Service Description Language
www.eu-egee.org
EGEE is a project funded by the European Union
under contract IST-2003-508833
2
Objectives
  • The role of WSDL
  • The structure of a WSDL document
  • types
  • message
  • portType
  • binding
  • service

3
What is the function of WSDL
  • WSDL represents a contract between the consumer
    and provider of a service.
  • It should guarantee a service format.

4
The function of WSDL
  • WSDL describes a services exposed interface
  • It is what a client sees of your service
  • WSDL includes information about
  • The data types it uses
  • Parameters it requires and returns
  • Groupings of functionality
  • The protocol to be used to access the service
  • The location or address of the service

5
WSDL Structure
  • A WSDL document is an XML document

lt?xml version"1.0" encoding"UTF-8"?gtltdefinition
sgt lttypesgt lt! define the types here using
XML Schema ? lt/typesgt ltmessagegt lt! XML
messages the web service uses are defined here ?
lt/messagegt ltportTypegt lt! define the input
and output parameters here -? lt/portTypegt
ltbindinggt lt! define the network protocol here
? lt/bindinggt ltservicegt lt! location of the
service ? lt/servicegtlt/definitionsgt
6
Referencing between sections
Each section refers to elements defined in other
sections
lt?xml version"1.0" encoding"UTF-8"?gtltdefinition
sgt lttypesgt lt! define the data types here
using XML Schema ? lt/typesgt ltmessagegt lt!
The message will refer to the types defined above
? lt/messagegt ltportTypegt lt! The operations
refer to the messages defined above -?
lt/portTypegt ltbindinggt lt! A binding refers to
a portType defined above ? lt/bindinggt
ltservicegt lt! The service refers to a particular
binding defined above ? lt/servicegtlt/definition
sgt
7
Simplified definitions
Each defines things referenced by other sections
8
ltimportgt element
  • ltdefinitions
  • targetNamespaceurn3950
  • xmlns http//schema.xmlsoap.org/wsdl/
  • xmlnsxsd http//www.w3c.org/2001/XMLSchema
  • xmlnssoap http//schemas.xmlsoap.org/wsdl/soap
    /
  • xmlnssoapenc http//schemas.xmlsoap.org/soap/em
    coding/
  • xmlnstns urn3950gt
  • ltimport namespace http//nesc.ac.uk location
    http//nesc.ac.uk/ez.xsd/gt

Acts like C/C include , or Java import.
Incorporates external namespaces
9
Namespaces
  • WSDL uses a number of different namespaces
    including
  • XML Schema Namespaces
  • http//www.w3.org/2000/10/XMLSchema
  • http//www.w3c.org/2001/XML-Schema-instance
  • WSDL Namespaces
  • http//schemas.xmlsoap.org/wsdl/soap/
  • http//schemas.xmlsoap.org/wsdl/
  • SOAP Namespaces
  • http//schemas.xmlsoap.org/soap/encoding
  • http//schemas.xmlsoap.org/soap/envelope

10
The lttypesgt
  • The types element contains XML Schemas defining
    the datatypes that are to be passed to and from
    the web service

lttypesgt ltschema targetNamespace"http//example.c
om/stockquote.xsd" xmlns"http//www.w3.org/2000/
10/XMLSchema"gt ltelement name"TradePriceRequest"
gt ltcomplexTypegt ltallgtltelement
name"tickerSymbol" type"string"/gtlt/allgt
lt/complexTypegt lt/elementgt ltelement
name"TradePrice"gt ltcomplexTypegt
ltallgtltelement name"price" type"float"/gtlt/allgt
lt/complexTypegt lt/elementgt lt/schemagt
lt/typesgt
11
The ltmessagegt
  • The ltmessagegt element is used to define the
    messages that will be exchanged between the
    client and the service
  • These message elements contain ltpartgt elements,
    which will be using types defined in the types
    element
  • All the parts are namespace qualified

ltmessage name"GetLastTradePriceInput"gt ltpart
name"body" element"xsd1TradePriceRequest"/gt
lt/messagegt ltmessage name"GetLastTradePriceOutput"
gt ltpart name"body" element"xsd1TradePrice"/gt
lt/messagegt
12
Relating messages and operations
  • Web services are a messaging system
  • For a normal method (operation) there will be
    generally two messages
  • A message is required to pass the parameters in.
  • A message is required to pass the return value
    out
  • Even a void return requires an empty return
    message

13
Messaging
Parametertype
1. Message in
void myMethod (parametertype)
2. Message out
Empty message
In non-messaging languages this is hidden
14
The ltportTypegt
  • The types and messages have been defined, but
    they have not been defined in terms of where they
    fit in the functionality of the web service
  • This is done within ltportTypegt and ltoperationgt
    elements
  • A portType is analogous to a class
  • An operation is analogous to a method in that
    class

ltportType name"StockQuotePortType"gt
ltoperation name"GetLastTradePrice"gt ltinput
message"tnsGetLastTradePriceInput"/gt
ltoutput message"tnsGetLastTradePriceOutput"/gt
lt/operationgtlt/portTypegt
15
Types of ltoperationgt
  • There are four distinct types of operation
  • Synchronous
  • Request-response - The service receives a message
    and sends a reply
  • Solicit-response - The service sends a message
    and receives a reply message
  • Asynchronous
  • One-way - The service receives a message
  • Notification - The service sends a message
  • All of these can be defined in WSDL

16
Defining the type of operation
  • Presence and order of input/output elements
    defines the type of operation.
  • Request-response ltinputgtltoutputgt
  • Solicit-response ltoutputgtltinputgt
  • One-way ltinputgt only
  • Notification ltoutputgt only

17
(No Transcript)
18
The ltbindinggt element
  • This element is used to define the mechanism that
    the client will actually use to interact with the
    web service
  • There are three possibilities
  • SOAP
  • HTTP
  • MIME
  • The most common choice is currently SOAP
  • The binding element defines the protocol specific
    information for the portTypes previously defined

19
The binding tag
  • ltbinding nameez3950SOAPBinding
    typetnsez3950PortTypesgt
  • The ltbindinggt tag indicates that we will map a
    ltPort Typegt to a protocol
  • ltsoapbinding stylerpc transporthttp//schema
    s.xmlsoap.org/soap/http/gt
  • Indicates we will be using the SOAP binding
    extensions to map the operations.
  • The alternative to rpc is document.
  • ( to use GET/POST use lthttpbindinggt
  • to use MIME use ltmimebinding..gt )

20
ltbindinggt Example
  • Below is an example of a binding element for SOAP

ltbinding name"StockQuoteSoapBinding
type"tnsStockQuotePortType"gt ltsoapbinding
style"document transport"http//schemas.xmlsoap
.org/soap/http"/gt ltoperation
name"GetLastTradePrice"gt ltsoapoperation
soapAction"http//example.com/GetLastTradePrice"/
gt ltinputgt ltsoapbody use"literal"/gt lt/inputgt
ltoutputgt ltsoapbody use"literal"/gt lt/output
gt lt/operationgtlt/bindinggt
21
ltservicegt
  • The final component of a WSDL file is the
    ltservicegt element
  • The ltservicegt element defines ltportgt elements
    that specify where requests should be sent
  • The ltsoapaddressgt subelement identifies the URL
    of the service
  • The precise content of ltportgt elements will be
    dependent upon the mechanism, i.e. SOAP, HTTP or
    MIME

ltservice name"StockQuoteService"gt ltport
name"StockQuotePort" binding"tnsStockQuoteBindi
ng"gt ltsoapaddress location"http//exampl
e.com/stockquote"/gt lt/portgtlt/servicegt
22
Overview of HelloService
23
lt?xml version"1.0" encoding"UTF-8"?gt
ltdefinitions name"HelloService"
targetNamespace"http//www.ecerami.com/wsdl/Hello
Service.wsdl" xmlns"http//schemas.xmlsoap.org/ws
dl/" xmlnssoap"http//schemas.xmlsoap.org/wsdl/s
oap/" xmlnstns"http//www.ecerami.com/wsdl/Hello
Service.wsdl" xmlnsxsd"http//www.w3.org/2001/XM
LSchema"gt   ltmessage name"SayHelloRequest"gt
ltpart name"firstName" type"xsdstring"/gt
lt/messagegt ltmessage name"SayHelloResponse"gt
ltpart name"greeting" type"xsdstring"/gt
lt/messagegt   ltportType name"Hello_PortType"gt
ltoperation name"sayHello"gt ltinput
message"tnsSayHelloRequest"/gt ltoutput
message"tnsSayHelloResponse"/gt lt/operationgt
lt/portTypegt  
24
ltbinding name"Hello_Binding" type"tnsHello_Port
Type"gt ltsoapbinding style"rpc"
transport"http//schemas.xmlsoap.org/soap/http"
/gt ltoperation name"sayHello"gt
ltsoapoperation soapAction"sayHello"/gt
ltinputgt ltsoapbody encodingStyle"htt
p//schemas.xmlsoap.org/soap/encoding/"
namespace"urnexampleshelloservice"
use"encoded"/gt lt/inputgt ltoutputgt
ltsoapbody encodingStyle"http//schemas.xm
lsoap.org/soap/encoding/" namespace"urnexam
pleshelloservice" use"encoded"/gt lt/outputgt
lt/operationgt lt/bindinggt
25
ltservice name"Hello_Service"gt
ltdocumentationgtWSDL File for
HelloServicelt/documentationgt ltport
binding"tnsHello_Binding" name"Hello_Port"gt
ltsoapaddress location"http//localhost
8080/soap/servlet/rpcrouter"/ gt lt/portgt
lt/servicegt lt/definitionsgt
Write a Comment
User Comments (0)
About PowerShow.com