scdjws 3. wsdl

21
WSDL Francesco Ierna

Upload: francesco-ierna

Post on 29-Jan-2018

2.106 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: SCDJWS 3. WSDL

WSDLFrancesco Ierna

Page 2: SCDJWS 3. WSDL

WSDLWSDL is :

XML Documents that allows formal XML descriptions of interfaces of Web Services. WSDL is an XML format for describing network services as a set of endpoints operating on messages containing either document-oriented or procedure-oriented information.

All possible functions into the interfaces. The operations and messages are described abstractly

Data type information for all message requests and for message response

Binding information about transport protocol to be used

Address information for locating the specified service.

Two layers :

Service definition layers

Data types

Message types

Operations

Services

Binding layers

Protocols

Data format

Page 3: SCDJWS 3. WSDL

Example : WSDL

Page 4: SCDJWS 3. WSDL

Example : WSDL

Page 5: SCDJWS 3. WSDL

Example : WSDL

Page 6: SCDJWS 3. WSDL

Example : WSDL

Page 7: SCDJWS 3. WSDL

Example : WSDL

Page 8: SCDJWS 3. WSDL

<definitions> <!-- root WSDL element -->

<types>

<!-- defines data types to be transmitted -->

</types>

<message>

<!-- defines messages to be transmitted →

</message>

<portType>

<!-- defines operations (functions) to be supported -->

</portType>

<binding>

<!-- defines how will the messages be transmitted on the wire -->

</binding>

<service>

<!-- defines location of web service -->

</service>

</definitions>

Example : WSDL

Page 9: SCDJWS 3. WSDL

Import: Import the definitions from a specified namespace in another WSDL document into the current WSDL document

namespace attribute, which value must match that of the namespace declared in the imported WSDL document. must not be a relative URI

location attribute, which cannot be empty or null, that must point to an actual WSDL document.

targetNamespace attribute in an imported WSDL document's <definitions> element must be the same as the value of the namespace attribute in the WSDL <import> element importing the WSDL document.

Definitions – Import

Page 10: SCDJWS 3. WSDL

Definitions : It defines the name of the web service, declares multiple namespaces used throughout the remainder of the document.

Root of the wsdl document

Declares multiples namespaces

Types : Contains XML schema and type definitions

Xsd:schema

Defines types in this namespaces or from other namespaces

Validates the particular wire format

Must be namaspeces defines in the targetnamespace or xsd:schema element or namespace in xsd:import

No extends or restrict array type and convenction ArrayOf

Messages : Consists of either a number of named parts typed by XML Schema elements, or a single part typed by a XML Schema type

One-way : single message request or single message response

Part message : parameter input/output

Port-type : describing a set of operations

One-way : only request to web service

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

Solicit-response : The operation can send a request and will wait for a response.

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

Definitions – Messages - Port-type

Page 11: SCDJWS 3. WSDL

1. Definitions  :

<definitions .... >

<types>

<xsd:schema .... />*

</types>

</definitions>

2. Definitions  :

<xsd:element name="MyArray1" type="tns:MyArray1Type"/>

<xsd:complexType name="MyArray1Type">

<xsd:sequence>

<xsd:element name="x" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>

</xsd:sequence>

</xsd:complexType>

Example : Definitions

Page 12: SCDJWS 3. WSDL

1. Message  :

<message name="OrderMsg">

<part name="productName" type="xs:string"/>

<part name="quantity" type="xs:integer"/>

</message>

2. Message : type RPC →

<message name="GetBulkBookPriceRequest">

<part name="isbn" type="xsd:string"/>

<part name="quantity" type="xsd:int"/>

</message>

3. Message : element Document→

<message name="SubmitPurchaseOrderMessage">

<part name="order" element="sd:purchaseOrder" />

</message>

4. Message : fault

<message name="InvalidArgumentFault">

<part name="error_message" element="sd:InvalidIsbnFaultDetail" />

</message>

Example : Message

Page 13: SCDJWS 3. WSDL

1. Port-type : one-way

<wsdl:definitions .... >

<wsdl:portType .... > *

<wsdl:operation name="nmtoken">

<wsdl:input name="nmtoken"? message="qname"/>

</wsdl:operation>

</wsdl:portType >

</wsdl:definitions>

2. Port-type : request - response

<wsdl:definitions .... >

<wsdl:portType .... > *

<wsdl:operation name="nmtoken" parameterOrder="nmtokens">

<wsdl:input name="nmtoken"? message="qname"/>

<wsdl:output name="nmtoken"? message="qname"/>

<wsdl:fault name="nmtoken" message="qname"/>*

</wsdl:operation>

</wsdl:portType >

</wsdl:definitions>

Example : Port-type

Page 14: SCDJWS 3. WSDL

3. Port-type : solicit-response

<wsdl:definitions .... >

<wsdl:portType .... > *

<wsdl:operation name="nmtoken" parameterOrder="nmtokens">

<wsdl:output name="nmtoken"? message="qname"/>

<wsdl:input name="nmtoken"? message="qname"/>

<wsdl:fault name="nmtoken" message="qname"/>*

</wsdl:operation>

</wsdl:portType >

</wsdl:definitions>

4. Port-type : notification

<wsdl:definitions .... >

<wsdl:portType .... > *

<wsdl:operation name="nmtoken" parameterOrder="nmtokens">

<wsdl:output name="nmtoken"? message="qname"/>

</wsdl:operation>

</wsdl:portType >

</wsdl:definitions>

Example : Port-type

Page 15: SCDJWS 3. WSDL

Bindings: Selects communication protocol and data formats for each operation and message. The binding element describes the concrete specifics of how the service will be implemented on the wire

Transport must be "http://schemas.xmlsoap.org/soap/http“.

Style must be either a RPC/Literal binding or a Document/Literal binding

location attribute in a <soapbind:address> element must be unique within a WSDL document

HTTP response from a web service operation using the one-way message exchange pattern must have an empty body

client of a web service operation using the one-way message exchange pattern must ignore any SOAP messages returned. Such a response just indicates that the message has reached the receiver

One or more WSDL documents may contain more than one WSDL <binding> elements that refer to one and the same WSDL <portType> element

WSDL document must have the same set of operations as the WSDL <portType> element to which the binding refers

SOAP message that is inconsistent with its WSDL document, it must check for “VersionMismatch”, “MustUnderstand” and “Client” fault conditions in that order.

Binding

Page 16: SCDJWS 3. WSDL

Document/Literal binding have at most one part listed in the parts attribute, if the parts attribute is specified

may, in its <soapbind:body> element(s), only refer to WSDL <part> elements that has been defined using the element attribute.

parts attribute with the value “” , the corresponding envelope must have an empty SOAP <Body> element

A RPC/Literal

in its <soapbind:body> element(s), only refer to WSDL <part> elements that has been defined using the type attribute

must contain exactly one part accessor element for each of the WSDL <part> elements bound to the envelope's corresponding <soapbind:body> element

has a parts attribute with the value “” (the empty string), the corresponding envelope must have no part accessor elements.

RPC : <soapbind:body> element has a use attribute with the value “literal”

<operation> element has a <soapbind:operation> child element with the style attribute having the value “rpc

Document : <soapbind:body> element has a use attrib. with the value “literal”

<operation> element has a <soapbind:operation> child element with the style attribute having the value “document

Same lists of operation between port-type and operation

Binding

Page 17: SCDJWS 3. WSDL

Example : Binding

Page 18: SCDJWS 3. WSDL

Example : Binding Header

Page 19: SCDJWS 3. WSDL

Service : Describes a collection of named ports, each associated with a binding and a network address. The service element defines the address for invoking the specified service.

One-way : single message request or single message response

Part message : parameter input/output

Port-type : describing a set of operations. WSDL Can have one or more <portType> elements, each defining an interface of a different web service. RPC or Document.

<operation> in a <portType> corresponds to a method in the interface of the web service.

at most one <input> and at most one <output> element and any number of <fault> elements.

One-way : only request to web service. May not declare any <fault> elements

Request-response : input message and web services respond with an output message. May additionally declare zero or more <fault> elements

Solicit-response : endpoint send an output message and then receives an input message

Notification : endpoint send an output message

Service - Port-type

Page 20: SCDJWS 3. WSDL

<portType name="StockQuotePortType">

<operation name="GetLastTradePrice">

<input message="tns:GetLastTradePriceInput"/>

<output message="tns:GetLastTradePriceOutput"/>

</operation>

</portType>

Example : Port-type

Page 21: SCDJWS 3. WSDL

<service name="StockQuoteService">

<documentation>My first service</documentation>

<port name="StockQuotePort" binding="tns:StockQuoteBinding">

<soap:address location="http://example.com/stockquote"/>

</port>

</service>

Example : Service