Anda di halaman 1dari 20

Web Services Description Language (WSDL) Chapter 23

Why WSDL ?

WSDL uses XML to describe interfaces Consider Web browsers and Web servers

What is WSDL ?

WSDL is a standard used to describe network services used to facilitate the interaction between web services providers and consumers.

What Does It Mean?

WSDL is not a programming language. Send me strings and I will return strings. I expect SOAP messages that include the strings in the body. I expect this body to be RPC encoded with the operation name so that I will know which operation the body contents belong to. I will return SOAP messages that include Strings in the body. These will also be encoded so that you know what to do with them.

Inside WSDL

WSDL standardizes XML elements that describe a collection of communication endpoints (also called as ports.) Each port is associated with a network address. Collectively ports of web services providers and web services consumers is called as network service.

WSDL defines a network service using seven XML elements WSDL Document
<definitions>: Root WSDL Element <type>: What data types will be transmitted? <message>: What messages will be transmitted? <operation>: What action will be supported? <portType>: What operations will be supported? <binding>: How will the messages be transmitted on the wire? <port>: Where is the service located? <service>: What other services are supported?

definitions

Must be the root element Define the name of the service Declare the namespaces used in the document Describe all the data type used by the Client and Server Can be omitted of only simple data types are used Define the name of the request/response messages Define also the message part elements Define the combination of message elements to form a complete one-way or round-trip operation

types

message

portType

10

binding

Provide specific details on how a portType operation will actually be transmitted over the wire SOAP specific information can be defined here. WSDL includes built-in extensions for defining SOAP services

service

Define the address for invoking the specified service


Provide human-readable documentation Similar to making comments in a program Allow importing other WSDL documents or XML Schemas into a WSDL document Enable a more modular WSDL document

documentation (less commonly used)


import (not all WSDL tools support)

11

<?xml version="1.0" encoding="UTF-8" ?> <wsdl:definitions > <wsdl:types > : </wsdl:types> Can be omitted if only simple data <wsdl:message > types, e.g. int, String are used : </wsdl:message> <wsdl:portType > : </wsdl:portType> <wsdl:binding > : </wsdl:binding> <wsdl:service > : A Sample WSDL file </wsdl:service> </wsdl:definitions>

12

WSDL Document

Organized into set a of three documents

1. Data Type Definition (DTD) 2. Abstract Definitions 3. Service Bindings

13

14

Data Type Definition file sample.dtd

15

16

portType Element

One-Way Transmission Request-Response Transmission Notification Transmission

17

WSDL and SOAP

18

SOAP with HTTP Binding


<binding name= " type= "> <http:binding verb="GET" /> <operation name= "> <http:operation location= " /> <input> <http:urlEncoded /> </input> <output> <mime:content type="text/html" /> </output> </operation> </binding>

19

WSDL and MIME Binding

20

Anda mungkin juga menyukai