Web Service - PowerPoint PPT Presentation

1 / 21
About This Presentation
Title:

Web Service

Description:

11/5/09. 1. Web Service. Metadata Exchange (http://msdn.microsoft.com/ws/2004/02/mex) ... This specification defines messages to retrieve specific types of metadata ... – PowerPoint PPT presentation

Number of Views:650
Avg rating:3.0/5.0
Slides: 22
Provided by: wsmo
Learn more at: http://www.wsmo.org
Category:
Tags: aiken | msdn | service | web

less

Transcript and Presenter's Notes

Title: Web Service


1
  • Web Service
  • Metadata Exchange
  • (http//msdn.microsoft.com/ws/2004/02/mex)
  • David Aiken
  • (7/4/04)

2
Introduction
  • This specification defines messages to retrieve
    specific types of metadata associated with an
    endpoint.
  • Uses XML, SOAP(1.1, 1.2) and WSDL(1.1)
    extensibility models.
  • Web services specifications (WS-) are designed
    to be composed with each other to provide a rich
    set of tools to provide security in the Web
    services environment.
  • This specification specifically relies on other
    Web services specifications to provide secure,
    reliable, and/or transacted message delivery and
    to express Web service and client policy.

3
Web Services
  • Web services use metadata to describe what other
    endpoints need to know to interact with them.
  • - WS-Policy describes the capabilities,
    requirements and general characteristics of Web
    services.
  • - WSDL(1.1) describes abstract message
    operations, concrete network protocols, and
    endpoint addresses used by Web services.
  • - XML Schema(part1, part2) describes the
    structure and contents of XML-based messages
    received and sent by Web services.
  • To bootstrap communication with a Web service,
    this specification defines three request/response
    message pairs to retrieve these three types of
    metadata
  • 1) WS-Policy receiving endpoint or
    target namespace.
  • 2) WSDL receiving endpoint or target
    namespace.
  • 3) XML Schema with a given target
    namespace.
  • Examples.

4
Terminology
  • Key words(S. Bradners paper RFC 2119)
  • MUST absolute requirement of the
    specification.
  • SHOULD there may exist valid reasons in
    particular circumstances to ignore a particular
    item.
  • MAY an item is truly optional.
  • Anything in Italics indicate data types not
    values.
  • ? 0 or 1.
  • 0 or more.
  • 1 or more.
  • items inside are to be treated as groups wrt
    cardinality or choice.
  • a point of extensibility allowing more
    attributes.
  • Prefix
    XML Namespace Specification(s)
  • Prefix XML namespace

    Specifications
  • s (Either SOAP 1.1 or 1.2)

    (Either SOAP 1.1 or 1.2)
  • s11 http//schemas.xmlsoap.org/soap/
    envelope
    SOAP 1.1 SOAP 1.1
  • S12 http//www.w3.org/2003/05/soap-e
    nvelope
    SOAP 1.2 SOAP 1.2
  • wsa http//schemas.xmlsoap.org/ws/20
    04/03/addressing WS-Addressing
    WSAddressing
  • wsdl http//schemas.xmlsoap.org/wsdl/

    WSDL WSDL 1.1
  • wsse http//schemas.xmlsoap.org/ws/200
    2/12/secext WS-SecurityPolicy
    WSSecurityPolicy
  • wsp http//schemas.xmlsoap.org/ws/200
    2/12/policy
    WS-Policy WS-Policy

5
Example 1 Get Policy Request
  • (01) lts12Envelope
  • (02) xmlnss12'http//www.w3.org/2003
    /05/soap-envelope'
  • (03) xmlnswsa'http//schemas.xmlsoap
    .org/ws/2004/03/addressing'
  • (04) xmlnswsx'http//schemas.xmlsoap
    .org/ws/2004/03/mex' gt
  • (05) lts12Headergt
  • (06) ltwsaActiongt
  • (07) http//schemas.xmlsoap.or
    g/ws/2004/03/mex/GetPolicy/Request
  • (08) lt/wsaActiongt
  • (09) ltwsaMessageIDgt
  • (10) uuid73d7edfc-5c3c-49b9-
    ba46-2480caee43e9
  • (11) lt/wsaMessageIDgt
  • (12) ltwsaReplyTogt
  • (13) ltwsaAddressgthttp//www.exa
    mple.com/MyEndpointlt/wsaAddressgt
  • (14) lt/wsaReplyTogt
  • (15) ltwsaTogt http//www.example.org/Y
    ourEndpointlt/wsaTogt
  • (16) ltexMyRefProp xmlnsex'http//ww
    w.example.com/refs' gt
  • (17) 78f2dc229597b529b81c4be
    f76453c96
  • (18) lt/exMyRefPropgt
  • (19) lt/s12Headergt

6
Example 1 Get Policy Request
  • Lines(6-8) indicate that this is a Get Policy
    request
  • Lines(10) is the MessageID for this request.
  • Lines(15-18) illustrate a typical pattern where
    the endpoint is identified by a wsaTo header
    block (15) as well as an application-specific
    header block(16-18)
  • Line(21) could alternatively include a target
    namespace instead of the associated receiving
    endpoint.
  • Now to respond to the Get Policy Request

7
Example 2Get Policy Response
  • (01) lts12Envelope
  • (02) xmlnss12'http//www.w3.org/2003/0
    5/soap-envelope'
  • (03) xmlnswsa'http//schemas.xmlsoap.o
    rg/ws/2004/03/addressing'
  • (04) xmlnswsp'http//schemas.xmlsoap.o
    rg/ws/2002/12/policy'
  • (05) xmlnswsx'http//schemas.xmlsoap.o
    rg/ws/2004/03/mex' gt
  • (06) lts12Headergt
  • (07) ltwsaActiongt
  • (08) http//schemas.xmlsoap.o
    rg/ws/2004/03/mex/GetPolicy/Response
  • (09) lt/wsaActiongt
  • (10) ltwsaRelatesTogt
  • (11) uuid73d7edfc-5c3c-49b9-
    ba46-2480caee43e9
  • (12) lt/wsaRelatesTogt
  • (13) ltwsaTogthttp//www.example.com/My
    Endpointlt/wsaTogt
  • (14) lt/s12Headergt
  • (15) lts12Bodygt
  • (16) ltwsxGetPolicyResponsegt
  • (17) ltwspPolicy
  • (18) xmlnswsse'http//schemas.xm
    lsoap.org/ws/2002/12/secext' gt
  • (19) ltwspOneOrMoregt

8
Example 2Get Policy Response
  • Lines(7-9) says this message is a response to a
    Get Policy Request.
  • Lines(10-12) this response is to the specific
    request (MessageID) we have just sent.
  • Lines(17-29) contains the Policy corresponding
    to the receiver.

9
Retrieving Metadata
  • Retrieving Policy
  • A requestor MAY send a Get Policy Request message
    to an endpoint.
  • If an endpoint accepts a Get Policy Request, it
    MUST reply with a Get Policy Response.
  • Retrieving WSDL
  • A requestor MAY send a Get WSDL Request message
    to an endpoint.
  • If an endpoint accepts a Get WSDL Request, it
    MUST reply with a Get WSDL Response.
  • Retrieving Schema
  • A requestor MAY send a Get Schema Request message
    to an endpoint.
  • If an endpoint accepts a Get Schema Request, it
    MUST reply with a Get Schema Response.

10
General outlineGet WSDL Request (1)
  • ltsEnvelope ...gt
  • ltsHeader ...gt
  • ltwsaActiongt
  • http//schemas.xmlsoap.org/ws
    /2004/03/mex/GetWSDL/Request
  • lt/wsaActiongt
  • ltwsaMessageIDgtxsanyURIlt/wsaMessage
    IDgt ?
  • ltwsaReplyTogtendpoint-referencelt/wsa
    ReplyTogt ?
  • ltwsaTogtxsanyURIlt/wsaTogt
  • ...
  • lt/sHeadergt
  • ltsBody ...gt
  • ltwsxGetWSDL ...gt
  • ltwsxTargetNamespacegtxsanyURIlt/wsxTa
    rgetNamespacegt ?
  • lt/wsxGetWSDLgt
  • lt/sBodygt
  • lt/sEnvelopegt
  • Action MUST be included to define the metadata
    to be returned.
  • ReplyTo if included MUST be of type
    wsaEndpointreferenceType.

0 or more
11
General outlineGet WSDL Response (2)
  • ltsEnvelope ...gt
  • ltsHeader ...gt
  • ltwsaActiongt
  • http//schemas.xmlsoap.org/ws/2
    004/03/mex/GetWSDL/Response
  • lt/wsaActiongt
  • ltwsaRelatesTogtxsanyURIlt/wsaRelatesTogt
    ?
  • ltwsaTogtxsanyURIlt/wsaTogt
  • ...
  • lt/sHeadergt
  • ltsBody ...gt
  • ltwsxGetWSDLResponsegt
  • ltwsdldefinitions ...gt ...
    lt/wsdldefinitionsgt
  • lt/wsxGetWSDLResponsegt
  • lt/sBodygt
  • lt/sEnvelopegt
  • Action MUST be included in the response message.
  • RelatesTo header block MUST be included and MUST
    have that value (MAY include a MessageID).
  • definitions SHOULD be repeated if there is gt 1
    WSDL in the target namespace

extensibility
1 or more
12
Faults (1)
  • No WSDL
  • If the receiver does not have a WSDL for the
    specified target namespace, the request MUST fail
    and the receiver MAY generate a SOAP fault as
    follows
  • SOAP 1.1
  • -faultcode s11client
  • -faultstring e.g., unknown target namespace
  • SOAP 1.2
  • -s12 Code/s12value s12Sender
  • -s12Code/s12Subcode/s12Value
    wsxUnkownTargetNamespace
  • -s12Reason/s12Text e.g., unknown target
    namespace

13
Faults (2)
  • Exposure
  • If the receiver does not expose WSDL for itself,
    the request MUST fail, and the receiver MAY
    generate a SOAP fault as follows
  • SOAP 1.1
  • -faultcode s11client
  • -faultstring e.g., WSDL unavailable for
    endpoint
  • SOAP 1.2
  • -s12 Code/s12value s12Sender
  • -s12Code/s12Subcode/s12Value
    wsxWSDLUnavailable
  • -s12Reason/s12Text e.g., WSDL unavailable
    for endpoint

14
General outline forGet Policy Request/Response
  • have already have seen a working example for
    this.
  • The faults would simply reply
  • -If receiver does not have Policy for the
    specified target namespace,
  • SOAP 1.1
  • -faultstring e.g., unknown target namespace
  • SOAP 1.2
  • -s12Code/s12Subcode/s12Value
    wsxUnkownTargetNamespace
  • -s12Reason/s12Text e.g., unknown target
    namespace
  • -If receiver does not expose policy for itself,
  • SOAP 1.1
  • -faultstring e.g., policy unavailable for
    endpoint
  • SOAP 1.2
  • -s12Code/s12Subcode/s12Value
    wsxUnkownTargetNamespace
  • -s12Reason/s12Text e.g., unknown target
    namespace

15
General outlineGet Schema Request (1)
  • ltsEnvelope ...gt
  • ltsHeader ...gt
  • ltwsaActiongt
  • http//schemas.xmlsoap.org/ws
    /2004/03/mex/GetSchema/Request
  • lt/wsaActiongt
  • ltwsaMessageIDgtxsanyURIlt/wsaMessage
    IDgt ?
  • ltwsaReplyTogtendpoint-referencelt/wsa
    ReplyTogt ?
  • ltwsaTogtxsanyURIlt/wsaTogt
  • ...
  • lt/sHeadergt
  • ltsBody ...gt
  • ltwsxGetSchema ...gt
  • ltwsxTargetNamespacegtxsanyURIlt/wsxTa
    rgetNamespacegt ?
  • lt/wsxGetSchemagt
  • lt/sBodygt
  • lt/sEnvelopegt
  • Action MUST be included to define the metadata
    to be returned.
  • ReplyTo if included MUST be of type
    wsaEndpointreferenceType.

16
General outlineGet Schema Response (2)
  • ltsEnvelope ...gt
  • ltsHeader ...gt
  • ltwsaActiongt
  • http//schemas.xmlsoap.org/ws/2
    004/03/mex/GetSchema/Response
  • lt/wsaActiongt
  • ltwsaRelatesTogtxsanyURIlt/wsaRelatesTogt
    ?
  • ltwsaTogtxsanyURIlt/wsaTogt
  • ...
  • lt/sHeadergt
  • ltsBody ...gt
  • ltwsxGetSchemaResponsegt
  • ltxsschemagt ... lt/xsschemagt
  • lt/wsxGetSchemaResponsegt
  • lt/sBodygt
  • lt/sEnvelopegt
  • Action MUST be included in the response message.
  • RelatesTo header block MUST be included and MUST
    have that value (MAY include a MessageID).
  • schema SHOULD be repeated if there is gt 1 XML
    Schema in the target namespace.

17
Fault
  • No Schema
  • If the receiver does not have a schema for the
    specified target namespace, the request MUST fail
    and the receiver MAY generate a SOAP fault as
    follows
  • SOAP 1.1
  • -faultcode s11client
  • -faultstring e.g., unknown target namespace
  • SOAP 1.2
  • -s12 Code/s12value s12Sender
  • -s12Code/s12Subcode/s12Value
    wsxUnkownTargetNamespace
  • -s12Reason/s12Text e.g., unknown target
    namespace
  • Unsure as to why there is no documentation on a
    receiver that does not expose its Schema!?

18
Other Faults (1)
  • If a get Policy, Get WSDL or Get Schema does not
    comply with the outlines we have just covered,
    the request MUST fail, and the receiver MAY
    generate a SOAP faults as follows
  • SOAP 1.1
  • -faultcode s11client
  • -faultstring e.g., message is invalid
  • SOAP 1.2
  • -s12 Code/s12value s12Sender
  • -s12Code/s12Subcode/s12Value
    wsxInvalidRequest
  • -s12Reason/s12Text e.g., message is invalid

19
Other Faults (2)
  • If the amount of data to be sent in a get Policy,
    Get WSDL or Get Schema response exceeds what the
    receiver can include, the request MUST fail, and
    the receiver MAY generate a SOAP faults as
    follows
  • SOAP 1.1
  • -faultcode s11client
  • -faultstring e.g., response is too large
  • SOAP 1.2
  • -s12 Code/s12value s12Receiver
  • -s12Code/s12Subcode/s12Value
    wsxResponseTooLarge
  • -s12Reason/s12Text e.g., response is too
    large

20
Normative Protocol Binding
  • A binding for the messages, SOAP(1.1) over http
    as constrained by the Basic Profile(1.0) is
    recommended as a means to bootstrap
    communication.
  • A web service if free to support these messages
    over other bindings in addition to , or in place
    of, the WSDL(1.1) binding.
  • If no other binding is explicitly stated then the
    default binding is assumed to be SOAP over http.

21
Conclusions
  • We saw a working example of a Get Policy
    Request/Response.
  • Also general outlines of Get WSDL and Get Schema
    including their faults
  • It is strongly recommended that the communication
    between web Services be secured using the
    mechanisms described in WS-Security.(presentation
    ?)
Write a Comment
User Comments (0)
About PowerShow.com