Hi,
Here we’ll learn the core part of WSDL.
Defn -
· Web Service Description Language (WSDL) is an XML-based dialect layered on top of the schema that describes a Web service.
· A WSDL document provides the information necessary for a client to interact with the Web service.
· WSDL is extensible and can be used to describe practically any network service, including SOAP over HTTP and even prot ocols that are not XML-based, such as DCOM over UDP.
· A WSDL definition is an XML document with a root definition element from the http://schemas.xmlsoap.org/wsdl/ namespace.
· The entire WSDL schema is available at http://schemas.xmlsoap.org/wsdl/ for your reference.
WSDL Document Syntax
The root of a WSDL document is the definitions element. Within this element are five types of child elements:
Element Name | Description |
types | · Contains schema definitions for the data exchanged between the client and the server. · The default schema language is XML Schema. |
message | · Identifies a particular message that is exchanged between the client and the server. · A message is composed of one or more parts. |
portType | · The portTypes element contains one or more operation elements. · An operation act as an interface—a contract about how the client and the server will interact with each other to perform an action. · An operation can be one of four types: Request-Response, Solicit-Response, One-Way, Or Notification. |
binding | · Used to associate a portType definition with a particular protocol. · This is accomplished via extensibility elements. Extensibility elements are elements defined outside the WSDL namespace. · The WSDL specification defines three sets of extensibility elements for specifying binding information: SOAP, HTTP GET/POST, and MIME |
service | · Contains one or more port elements / endpoints. · An endpoint is defined as a combination of a binding and an address (URI) · A port element is used to define an address where a Web service that supports a particular binding can be reached. |
Below figure illustrates how these five elements are layered on top of the schema definition to describe the Web service.
types Element
· The types element contains schema information referenced within the WSDL document.
· The default type system supported by WSDL is XML Schema. If XML Schema is used to define the types contained within the types element, the schema element will appear as an immediate child element.
· Within the types element are schema definitions for the Add and Subtract methods, which use the reference to the schema’s namespace that appears within the definitions element earlier in the WSDL document.
message Element
· Multiple message elements can and often do appear in a WSDL document, one for each message being communicated between the client and the server.
· Each message contains one or more part elements. Each part element describe pieces of content within the message. Part could be the body of a SOAP message or a parameter contained within the query string, a parameter encoded in the body of a SOAP message, or the entire body of a SOAP message.
· Each part is represented by the part element and can refer to an element or type definition defined within the types element. i.e as below.
· Two attributes that can appear within the part element are the element and type attributes.
· The element attribute refers to an element definition in a schema. The type attribute refers to a type definition in a schema.
portType Element
· The portType element contains a set of abstract operations representing the types of correspondences that can occur between the client and the server.
· For RPC-style Web services, a portType can be thought of as an interface definition in which each method can be defined as an operation.
· A port type is composed of a set of operation elements that define a particular action.
· An operation is composed of a subset of input, output, and fault elements.
· The type of elements and the ordering of the elements within the operation determine the type of operation. For example, one-way defines an input message, and request-response defines an input and an output message.
WSDL defines four types of operations, known as operation types:
· Request-response RPC-style communication in which the client makes a request and the server issues a corresponding response.
· One-way Document-style communication in which the client sends a message but does not receive a response from the server indicating the result of the processed message.
· Solicit-response The opposite of the request-response operation. The server sends a request, and the client sends back a response.
· Notification The opposite of the one-way operation. The server sends a document-style communication to the client.
binding Element
· Associates the portType definition with a particular protocol.
· The binding definitions also indicate the number of network communications required to perform a particular action. For example, a SOAP RPC call over HTTP might involve one HTTP communication exchange, but that same call over SMTP would involve two discrete SMTP communication exchanges.
· The binding element is associated with a particular portType element via the type attribute.
service Element
· Defines a collection of related endpoints (ports) exposed by the Web service.
· A port is a particular endpoint for the Web service that is referenced by a single address.
· A port contains an extension element that provides the address where it is located. If you need to specify more than one address, you must create one port for each address.
· If you define multiple ports of the same port type (and possibly different addresses) within the same Web service, they should be considered alternatives.
Thanks & Regards,
Arun Manglick || Senior Tech Lead
No comments:
Post a Comment