Saturday, 25 February 2017

What is WSDL and difference between abstract and concrete WSDL

An official W3C standard, the Web Services Description Language (WSDL) is an XML language for describing web services. WSDL 1.1 (which is still in wide use) has five major elements--types, message, portType, binding, and service.  All these major elements may be defined 0 or more times in a WSDL document, except for <types>, which may be 0 or 1 time. Here's a short description of each:

types: This is where XML types to be used in the WSDL document are defined. Traditionally, this has meant using XML Schema, but newer versions of WSDL also support Relax NG.

message: This is the section where the input or output parts of an operation are defined, i.e. the "parameters" or "return types". It may have multiple child <part> elements, though WS-I forbids the use of more than one part per message in a document literal style service. The <part> itself may have an element (referring to a qualified XML element) or a type (referring to an XML Schema type) attribute.

portType: Here is where the operations that a web service offers are defined in terms of messages (input and output, with faults). Faults (referring to SOAP faults here) are the web service equivalent of the exception in languages like C++ or Java; most SOAP toolkits will translate SOAP faults into exceptions at runtime.

binding: This is the "how" of a service, specifying the binding of the operations defined in the portType(s) to specific protocols, such as SOAP.

service: This is the "where" of the service, specifying the address where a bound operation may be found.

Example of WSDL document:

 <?xml version="1.0" encoding="UTF-8" ?>
<definitions targetNamespace="urn:Emp" xmlns="" xmlns:tns="urn:Emp"
             xmlns:soap12="" xmlns:mime=""
             xmlns:xsd="" xmlns:soap=""
    <xsd:schema targetNamespace="urn:Emp/types" elementFormDefault="qualified"/>
      <xsd:import schemaLocation="../Schema/Emp.xsd" namespace=""/>
  <portType name="EmpDetailsPort">
    <operation name="EmpRequestOperation">
      <input message="tns:EmpDetailsPort_EmpRequest"/>
      <output message="tns:EmpDetailsPort_EmpResponse"/>
  <message name="EmpDetailsPort_EmpRequest">
    <part name="part" element="weo:EmpRequest"/>
  <message name="EmpDetailsPort_EmpResponse">
    <part name="part" element="weo:EmpResponse"/>
  <binding name="EmpDetailsPortSOAP11Binding" type="tns:EmpDetailsPort">
    <soap:binding style="document" transport=""/>
    <operation name="EmpRequestOperation">
      <soap:operation style="document" soapAction="urn:Emp/EmpRequestOperation"/>
        <soap:body use="literal" parts="part"/>
        <soap:body use="literal" parts="part"/>
  <service name="EmpDetailsPort">
    <port name="EmpDetailsPortPort" binding="tns:EmpDetailsPortSOAP11Binding">
      <soap:address location=""/>

Abstract and Concrete WSDLs

A WSDL document can be divided into "abstract" and "concrete" portions that by convention often are defined in two or more files (where the concrete file imports the abstract one). The abstract elements are <types>, <message>, and <portType> (or <interface> in 2.0); the concrete ones are <binding> and <service>. Separating these two sections allows for maximal reuse and flexibility in defining services.

No comments:

Post a Comment