About Web Services Definition Language (WSDL)

• WSDL-Service Description: 
   Service Description carries information about the service such as the input or output parameter, the    location of the service, port type, binding information, and so on.
• Web Services Definition Language
  – http://www.w3.org/TR/wsdl/
• An XML-based language for describing Web Services
  – what the service does (description)
  – how to use it (method signatures)
  – where to find the service
• It does not depend on the underlying protocol
• WSDL is an XML grammar for describing a web service as a collection of access endpoints.
• Capable of exchanging messages in a procedure or document-oriented fashion.

• A WSDL document is a recipe used to automate the details involved in application-to-application communication.

Anatomy of a WSDL Document

The following code shows the major elements that may appear in a WSDL document.
An asterisk (*) next to an element indicates that more than one of these elements may appear.
</definitions >

WSDL Elements
• Types – will give namespace and schema location.
• Message - Request/response messages.
• Operation - Name of operation.
• Port Type – Actual WebService.
• Binding – Binds on particular port.
• Port - URL of WS on which it is running.
• Service – web Service.

<definitions> Element
The <definitions> element in a WSDL document acts as a
container for the service description.
It provides a place to do global declarations of namespaces
that are intended to be visible throughout the rest of the

<definitions targetNamespace="urn:3950" xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/ “ xmlns:tns="urn:3950">

<import> Element
The <import> element serves a purpose similar to the #include directive in the C/C++ programming language.After the <definitions> element, we see an <import> element:

<definitions targetNamespace="urn:3950" xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/“ xmlns:tns="urn:3950">
<import namespace="http://asf.gils.net/xer" location="http://asf.gils.net/xer/ez.xsd"/>

<types> Element
• The <types> element in a WSDL document acts as a container for defining the data types used in <message> elements.
• <message> elements define the format of messages interchanged between a client and a web service.
• The <types> element has zero or more <schema> sub elements.

<message> Element
• The <message> element is used to model the data exchanged as part of a web service.
• <message> elements reference the types defined in the <types> section.
• A message consists of one or more <part> subelements.
• A <part> subelement identifies the individual pieces of data that are part of this data message and the datatypes that the pieces adhere to.

<portType> Element
• The <portType> element specifies a subset of operations supported for an endpoint of a web service.
• In a sense, a <portType> element provides a unique identifier to a group of actions that can be executed at a single endpoint

<binding> Element
A <binding> element is a concrete protocol and data format specification for a <portType>element.
It is where you would use one of the standard binding extensions-HTTP, SOAP, or MIME-or create one of your own.

<service> Element
The <service> element typically appears at the end of a WSDL document and identifies a web service.

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://emp" mlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://emp" xmlns:intf="http://emp" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.4 Built on Apr 22, 2006 (06:55:48 PDT)-->

  <schema elementFormDefault="qualified" targetNamespace="http://emp" xmlns="http://www.w3.org/2001/XMLSchema">
   <element name="getName">
      <element name="sName" type="xsd:string"/>
   <element name="getNameResponse">
      <element name="getNameReturn" type="xsd:string"/>
   </element>  </schema> </wsdl:types>

 <wsdl:message name="getNameResponse">
 <wsdl:part element="impl:getNameResponse" name="parameters"/>
 <wsdl:message name="getNameRequest">
 <wsdl:part element="impl:getName" name="parameters"/>
 <wsdl:portType name="employee">
 <wsdl:operation name="getName">
 <wsdl:input message="impl:getNameRequest" name="getNameRequest"/>
 <wsdl:output message="impl:getNameResponse" name="getNameResponse"/>
 <wsdl:binding name="employeeSoapBinding" type="impl:employee">
      <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
      <wsdl:operation name="getName">
         <wsdlsoap:operation soapAction=""/>
         <wsdl:input name="getNameRequest">
            <wsdlsoap:body use="literal"/>
         <wsdl:output name="getNameResponse">
            <wsdlsoap:body use="literal"/>
 <wsdl:service name="employeeService">
 <wsdl:port binding="impl:employeeSoapBinding" name="employee">
 <wsdlsoap:address location="http://localhost:8080/employee/services/employee"/>

Web Service Request/ Response

1 comment:

Please provide your input, it will honer for me...