Overview of WSDL


WSDL stands for Web service Description Language.

A WSDL document is a contract between a SOAP–based web service and its consumers.

A WSDL document provides critical information such as service endpoint, service operations, data types required for operations, description of messages exchanged, and underlying service pattern (request/response, solicit/response etc).

The WSDL document is useful for both creating and executing clients against a web service.


WSDL Structure

The root element in a WSDL is named definitions as the WSDL provides definitions grouped into various sections like:

  • types section

  • message section

  • portType section

  • binding section

  • service section




The types section

  • The types section provides data type definitions under some data type system such as XML schema.

  • The types section can hold, points to, or imports an XSD.

  • If the types section is empty, then the service uses only simple data types such as xsd:string and xsd:long.

  • The types section is optional.

  • Although the WSDL 2.0 specification allows for alternatives to XML schema, XML schema is the default and the dominant type system used in WSDL.




The message section

  • The message section defines the messages. 

  • Message is an abstract, typed definition of the data being communicated.

  • All input parameters for a web service operation (method) are considered together as one input message.

  • At runtime each message is a SOAP document.

  • The order of the messages indicates the service pattern.

    • For example the message order in/out indicates the request/response pattern.




The portType section

  • The port Type section groups the operations that the web service delivers,

    • Operation is an abstract description of an action supported by the web service.

    • Each operation having one or more messages.

      • An input message means input to the web service and output message means messages from a web service.

      • All input parameters for a web service operation (method) are bundled together as one input message.

      • These messages are also defined separately in the messages section.

      • At runtime each message is a SOAP document.

    • The portType section presents the services as named operations.

      • Operations are named after methods annotated as @WebMethod.

  • The WSDL portType presents the service operations abstractly but provides no implementation details.

    • A web service’s portType is similar to a java interface that, it presents the service abstractly, with no implementation details.




The binding section

  • A WSDL binding provides concrete details about the service.

  • Specify implementation details of a service defined abstractly in the potType section :

    • The transport protocol to be used in sending and receiving SOAP messages.

    • The style of the service – rpc or document

    • The data format to be used in the SOAP message – literal and encoded.




The service section

  • The service section list one or more port elements.

    • A port consists of a portType (interface) together with a corresponding binding (implementation).

  • Service section specifies one or more end points at which the service’s functionality is available.

    • A service endpoint url is contained in the location attribute of <soap:address>, which is inside the service section.   

    • The service endpoint url informs clients about where the service can be accessed.




Fault Elements

  • Application exceptions can be mapped to faults in WSDL.

  • Fault elements may come in places such as:

    • Within a message element as a part:

      • <part name="fault" element="tns:MissingName" />

    • As a child of operation element within portType section.

      •  <fault message="tns:MissingName" name="MissingName" /> 

    • As a child of operation element within binding section

      • <fault name="MissingName">

      • <soap:fault name="MissingName" use="literal" /> 

      • </fault>


Example: Try it out yourself in coming lab.


Advantages of WSDL

  • WSDL is platform and language neutral.

    • A WSDL generated by a c# program can be used to generate a Java web service.

  • With WSDL and XSD, the definition of the message can travel with the message.


Limitations of WSDL

  • Though a wsdl provides details on how to invoke a service, it does not contain information about the use of the service.

    • Programmer should be aware about the use of a service. 

Quick Notes Finder Tags

Activities (1) advanced java (1) agile (3) App Servers (6) archived notes (2) ArrayLists (1) Arrays (2) Best Practices (12) Best Practices (Design) (3) Best Practices (Java) (7) Best Practices (Java EE) (1) BigData (3) Chars & Encodings (6) coding problems (2) Collections (15) contests (3) Core Java (All) (53) course plan (2) Database (12) Design patterns (8) dev tools (3) downloads (2) eclipse (9) Essentials (1) examples (14) Exception (1) Exceptions (4) Exercise (1) exercises (6) Getting Started (18) Groovy (2) hadoop (4) hibernate (77) hibernate interview questions (6) History (1) Hot book (5) http monitoring (2) Inheritance (4) intellij (1) java 8 notes (4) Java 9 (1) Java Concepts (7) Java Core (8) java ee exercises (1) java ee interview questions (2) Java Elements (16) Java Environment (1) Java Features (4) java interview points (4) java interview questions (4) javajee initiatives (1) javajee thoughts (3) Java Performance (6) Java Programmer 1 (12) Java Programmer 2 (8) Javascript Frameworks (1) Java SE Professional (1) JPA 1 - Module (6) JPA 1 - Modules (1) JSP (1) Legacy Java (1) linked list (3) maven (1) Multithreading (16) NFR (1) No SQL (1) Object Oriented (9) OCPJP (4) OCPWCD (1) OOAD (3) Operators (4) Overloading (2) Overriding (2) Overviews (1) policies (1) programming (1) Quartz Scheduler (1) Quizzes (17) RabbitMQ (1) references (2) resources (1) restful web service (3) Searching (1) security (10) Servlets (8) Servlets and JSP (31) Site Usage Guidelines (1) Sorting (1) source code management (1) spring (4) spring boot (3) Spring Examples (1) Spring Features (1) spring jpa (1) Stack (1) Streams & IO (3) Strings (11) SW Developer Tools (2) testing (1) troubleshooting (1) user interface (1) vxml (8) web services (1) Web Technologies (1) Web Technology Books (1) youtube (1)