WSDL Web Services Description Language - PowerPoint PPT Presentation

About This Presentation
Title:

WSDL Web Services Description Language

Description:

WSDL Web Services Description Language Goals of WSDL Describes the formats and protocols of a Web Service in a standard way The operations the service supports The ... – PowerPoint PPT presentation

Number of Views:2
Avg rating:3.0/5.0
Slides: 36
Provided by: ComputerS52
Category:

less

Transcript and Presenter's Notes

Title: WSDL Web Services Description Language


1
WSDLWeb Services Description Language
2
Goals of WSDL
  • Describes the formats and protocols of a Web
    Service in a standard way
  • The operations the service supports
  • The message(s) needed to invoke the operations
  • The binding of the messages to a communication
    protocol
  • The address to which messages should be sent
  • Serves the same function as an Interface
    Description Language (IDL)

3
WSDL Description
  • A Web Service is described at both the abstract
    and concrete levels
  • Abstract Level
  • What are the operations that are supported?
  • What messages are needed to invoke the
    operations?
  • Concrete Level
  • How are the messages bound to a transport
    protocol?
  • What is the Web address to which the messages
    should be sent?

4
WSDL Abstract Level
  • At the abstract level, obtaining a service is
    like executing a method of an object
  • WSDL defines the following elements
  • An interface is like an object it consists of a
    set of operations
  • An operation is like a method it is invoked by
    messages
  • A message is composed of parts
  • A part is like a parameter and has an associated
    type

5
Example
  • ltinterface name GetQuoteIfgt
  • ltoperation name getQuoteOp
  • patternhttp//www.w3.org/
    2003/06/wsdl/in-outgt
  • ltinput message gsgetQuoteOpReq/gt
  • ltoutput message gsgetQuoteOpResp
    /gt
  • ltoutfault name invalidSymbolFault
  • messageReferencegsgetQuoteOpResp
  • message
    gsinvalidSymbolFaultMsg/gt
  • lt/operationgt
  • lt!-- other operations go here --gt
  • lt/interfacegt

gs is the target namespace of the document
containing this declaration and the message
declarations
6
Patterns
  • The messages exchanged when an operation is
    invoked conform to a pattern
  • WSDL is considering a number of patterns, each
    identified by a URI. The most commonly used are
  • In-Out
  • Input sent by requestor, output produced by
    service
  • Might be synchronous (requestor waits for
    response e.g. RPC) or asynchronous
  • In-Only
  • Input sent by requestor, no response expected

7
Faults
ltoutput message gsgetQuoteOpResp/gt ltoutfault
name invalidSymbolFault messageReferencegs
getQuoteOpResp message
gsinvalidSymbolFaultMsg/gt
  • In-Out pattern uses a Fault Replaces Message
    fault rule
  • Server replaces the message referenced by
    messageReference with message if it detects a
    fault
  • Server raises the named fault in the requestor
  • In-Only pattern uses No Fault fault rule
  • No fault message is allowed

8
Other Message Patterns (tentative)
  • Robust In-Only
  • Same as In-Only except that a fault message is
    allowed using Message Triggers Fault rule
  • Server responds to input message with a fault
    message
  • In-Multi-Out
  • A single input message followed by 0 or more
    instances of output message in response
  • Uses Fault Replaces Message Rule rule
  • Out Only
  • Out-In
  • Out-Multi-In .
  • and users can define their own rule

9
Example Message Definitions
  • ltmessage name getQuoteOpReqgt
  • ltpart name stockSymbol type
    xsdstring/gt
  • lt/messagegt
  • ltmessage name getQuoteOpRespgt
  • ltpart name stockSymbol type
    xsdstring/gt
  • ltpart name QuoteValue type
    xsdfloat/gt
  • lt/messagegt
  • ltmessage name invalidSymbolFaultMsggt
  • ltpart name faultInfo type
    gsfaultType/gt
  • lt/messagegt

10
Parts of a Message
  • A message can have many parts
  • Each part can be bound to a different position
    within the physical message sent by the transport
  • With SOAP parts can be distributed over body and
    header blocks
  • Each part can have a simple or complex type
    defined in an XML schema

11
Example
  • ltschemagt
  • ltcomplexType name faultTypegt
  • ltsequencegt
  • ltelement name faultCode type
    string/gt
  • ltelement name faultDetail type
    string
  • minOccurs 0 maxOccurs 1/gt
  • lt/sequencegt
  • lt/complexTypegt
  • lt/schemagt

12
Concrete Level
  • The concrete level defines how interfaces and
    operations are bound to transports and addresses
  • A given interface can be bound to several
    different transports and addresses
  • A Web Service might support an interface using
    several different transports
  • For example, the operations can be invoked using
    SOAP over either HTTP or SMTP
  • The same interface might be supported by several
    different Web Services using the same or
    different transports
  • In all of these cases, semantically identical
    service should be provided at each address

13
Concrete Level
  • At the concrete level WSDL defines the following
    elements
  • A binding describes how the operations and
    messages of an interface are mapped into the
    messages of a particular transport
  • An endpoint maps a binding to a Web address
  • A service is a collection of endpoints that host
    related interfaces

14
Example Service and Endpoint
identifies binding
  • ltservice name GetQuoteServicegt
  • ltendpoint name GetQuoteRPC
    bindinggqGetQuoteSOAPBindinggt
  • ltsoapaddress location
    http//www.shearson.com/quoteservice/gt
  • lt/endpointgt
  • lt!Other endpoints go here --gt
  • lt/servicegt

15
WSDL Extensibility
  • A binding maps an interface to a particular
    transport
  • It must be capable of targeting a variety of
    transports
  • Each transport has its own idiosynchrosies
  • WSDL is extended by introducing a different
    namespace for each transport

ltdefinitions xmlnshttp//schemas.xmlsoap.o
rg/wsdl/ xmlnsxsdhttp//www.w3.org/2001/
XMLSchema xmlnssoaphttp//schemas.xmlsoap
.org/wsdl/soap/ targetNamespacehttp//www.s
hearson.com/quoteservicegt lt!-- WSDL
declarations go here --gt lt/definitionsgt
introduce SOAP namespace
16
Example RPC/encoded SOAP Binding
identifies interface
  • ltbinding name GetQuoteSOAPBinding type
    tnsGetQuoteIfgt
  • ltsoapbinding style rpc
  • transport http//schemas.xmlsoap.
    org/soap/http//gt
  • ltoperation name getQuoteOpgt
  • ltinputgt
  • ltsoapbody
  • use encoded
  • namespace
    http//www.shearson.com/quoteservice
  • encodingStyle
    http//schemas.xmlsoap.org/soap/encoding/gt
  • lt/inputgt
  • Continued on next slide

rpc style msg
for tags used in messsage
SOAP extensions
encode parameters
encoding rules
17
Binding Example - Continued
  • ltoutputgt
  • ltsoapbody
  • use encoded
  • namespace
    http//www.shearson.com/quoteservice
  • encodingStyle
    http//schemas.xmlsoap.org/soap/encoding//gt
  • lt/outputgt
  • lt/operationgt
  • lt!-- other operations go here
    --gt
  • lt/bindinggt

18
RPC/encoded Message
ltsEnvelope xmlnsshttp//www.w3.org/2003/05/soa
p-envelope xmlnsxsdhttp//www.w3.org/20
01/XMLSchema xmlnsxsihttp//www.w3.org/
2001/XMLSchema-instancegt ltsBodygt ltngetQuot
eOp xmlnsnhttp//www.shearson.com/quoteService
gt ltnstockSymbol xsitypexsdstringgt IBM
lt/nstockSymbolgt lt/ngetQuoteOpgt
lt/sBodygt lt/sEnvelopegt
19
Encoding
  • Problem serializer serializes arguments in
    accordance with rules specified by encodingStyle
    attribute
  • Receiver can deserialize arguments since style is
    specified in the message
  • But message has a declared type
  • How can we be sure that the rules produce an
    instance of the type?
  • In fact they might not!

20
Example Encoding Style
  • Suppose there are n arguments of the same type.
  • Serializer might produce a message containing n
    instances of the type.
  • But suppose in a particular invocation all
    arguments have same value.
  • Serializer might produce a message containing n
    pointers to a single instance of the value
  • Then value of each parameter (a pointer) is not
    an instance of the type

21
Encoded Vs. Literal
  • If useencoded, parameters are encoded in
    accordance with the specified encoding style
  • If useliteral, parameters are instances of
    types specified in the message declaration
  • Yields two distinct styles for invoking a remote
    procedure
  • rpc/encoded
  • rpc/literal

22
Encoded Vs. Literal
  • If useencoded, parameters are encoded in
    accordance with the specified encoding style
  • If useliteral, parameters are instances of
    types specified in the message declaration
  • Yields two distinct styles for invoking a remote
    procedure
  • rpc/encoded
  • rpc/literal

23
Example RPC/literal SOAP Binding
identifies interface
  • ltbinding name GetQuoteSOAPBinding type
    tnsGetQuoteIfgt
  • ltsoapbinding style rpc
  • transport http//schemas.xmlsoap.
    org/soap/http//gt
  • ltoperation name getQuoteOpgt
  • ltinputgt
  • ltsoapbody
  • use literal
  • namespace
    http//www.shearson.com/quoteservice/gt
  • lt/inputgt
  • ltoutputgt . lt/outputgt
  • lt/operationgt
  • lt/bindinggt

rpc style msg
dont encode parameters
24
RPC/literal SOAP Binding
lttypesgt ltschemagt ltcomplexType
namecomptypgt lt/complexTypegt
ltschemagt lt/typesgt ltmessage namemsggt ltpart
namepart1 typecomptyp /gt lt/messagegt ltsoap
Envelopegt ltsoapBodygt ltnmyProc
xmlnsn gt ltnpart1gt
instance of comptyp lt/npart1gt
lt/nmyProcgt lt/soapBodygt lt/soapEnvelopegt
25
RPC/encoded and RPC/literal
  • RPC style specified for both bindings
  • There is no schema describing the message body
  • Child of body uses name of procedure
  • Each grandchild corresponds to a parameter and
    uses parameter name
  • Might be a grandchild for result returned
  • Validation not possible

26
Sending Documents
  • Increasingly, Web communication is
  • Asynchronous
  • Web Services are loosely coupled (as opposed to
    tightly coupled, object-oriented systems that are
    developed in a more integrated fashion and are
    more oriented towards rpc)
  • More appropriate for delay prone/failure prone
    environments
  • Messages contain XML documents (instead of
    procedure arguments)
  • A wide variety of communication patterns (as
    opposed to simply in-out) are useful

27
Document Style Messaging
ltmessage name sendInvoiceMsggt ltpart name
invoice type invinvoiceType/gt lt/messagegt
ltinterface name invoiceIfgt ltoperation
name sendInvoiceOp pattern
http//www.w3.org/2003/06/wsdl/in-onlygt
ltinput message invsendInvoiceMsg/gt
lt/operationgt lt/interfacegt
one-way message
28
Document/literal Binding
SOAP body contains XML documents
ltbinding name sendInvBinding type
inginvoiceIfgt ltsoapbinding style
document transport
http//schemas.xmlsoap.org/soap/http/gt
ltoperation name invsendInvoiceOpgt
ltinputgt ltsoapbody use
literal namespace
http//www.invoicesource.com/invoice/gt
lt/inputgt lt/operationgt lt/bindinggt
body is an instance of part type
29
Document/literal SOAP Binding
Alternative 1 one part specified by a type
lttypesgt ltschemagt ltcomplexType
namecomptypgt lt/complexTypegt
ltschemagt lt/typesgt ltmessage namemsggt ltpart
namepart1 typencomptyp /gt lt/messagegt ltsoa
pEnvelopegt ltsoapBodygt instance of
comptyp lt/soapBodygt lt/soapEnvelopegt
n is target namespace of this document
message can have only one part in this case since
the schema of the body can have only one type
specification
30
Document/literal SOAP Binding
Alternative 2 part specified by an element
lttypesgt ltschemagt ltelement nameelem
typencomptyp /gt ltcomplexType
namecomptypgt lt/complexTypegt
ltschemagt lt/typesgt ltmessage namemsggt ltpart
namepart1 elementnelem /gt lt/messagegt ltsoa
pEnvelopegt ltsoapBodygt ltnelem
xmlns target ns of WSDL doc gt
instance of comptyp
lt/nelemgt lt/soapBodygt lt/soapEnvelopegt
Part is identified as an element. An instance
of element is a child of body, named with
elements name, typed with elements type
31
Sending Multiple Documents
ltelement namefirstInvoice typeinvinvoiceTyp
e /gt ltelement namesecondInvoice
typeinvinvoiceType /gt ltcomplexType
nameinvoiceTypegt lt!-- the complex type
definition goes here --gt lt/complexTypegt ltmessage
name sendInvoiceMsggt ltpart name
invoicei element invfirstInvoice /gt
ltpart name invoice2 element
invsecondInvoice /gt lt/messagegt
element specification must be used since message
has multiple parts
ltsoapBodygt ltinvfirstInvoicegt lt!--
instance of invoiceType goes here --gt
lt/invfirstInvoicegt ltinvsecondInvoicegt
lt!-- instance of invoiceType goes here --gt
lt/invsecondInvoicegt lt/soapBodygt
32
Sending Messages By Email Simple Mail Transfer
Prototol
  • ltservice name GetQuoteSMTPServicegt
  • ltendpoint name GetQuoteSMTP
  • bindinggqGetQuoteSMTPBin
    ding/gt
  • ltsoapaddress
  • location
    mailtostockquote_at_shearson.com/gt
  • lt/endpointgt
  • lt/servicegt

33
Mail Example (continued)
  • ltbinding name GetQuoteSMTPBinding
  • type tnsGetQuoteIfgt
  • ltsoapbinding style document
  • transporthttp//schemas.xmlsoap
    .org/soap/smtp /gt
  • ltoperation name getQuoteOpgt
  • ltinputgt
  • ltsoapbody useliteral/gt
  • lt/inputgt
  • ltoutputgt
  • ltsoapbody useliteral/gt
  • lt/outputgt
  • lt/operationgt
  • lt/bindinggt

34
Complete WSDL Document
ltdefinitions targetNamespace.
xmlns gt lttypesgt lt!
specification of XML Schema types used in this
document --gt lt/typesgt ltmesssagegt
lt/messsagegt lt! specification of other
messages goes here--gt ltinterfacegt
lt/interfacegt lt! specification of other
interfaces goes here--gt ltbindinggt
lt/bindinggt lt! specification of other
bindings goes here--gt ltservicegt
ltendpointgt lt/endpointgt lt!
specification of other endpoints goes here--gt
lt/servicegt lt/definitionsgt
35
What WSDL Cannot Do
  • WSDL describes how one operation can be invoked
  • getQuoteOp
  • Many services require a sequence of operations
  • Send this message, receive that message, if this
    happens send this other message to another
    endpoint, etc
  • Cannot be described in WSDL
  • BPEL describes the logic of a Web Service
  • How it is impemented
  • How it communicates with other busienss processes
  • Sometimes called an orchestration language
Write a Comment
User Comments (0)
About PowerShow.com