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

 

Example:

 

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.

 

Example:

 

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.

 

Example:

 

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.

 

Example:

 

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.

 

Example:

 

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.

 

Example:

 

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. 

Search the Web

Custom Search

Searches whole web. Use the search in the right sidebar to search only within javajee.com!!!

Quick Notes Finder Tags

Activities (1) advance java (1) agile (3) App Servers (6) archived notes (2) Arrays (1) 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) (52) course plan (2) Database (12) Design patterns (8) dev tools (3) downloads (2) eclipse (9) Essentials (1) examples (14) Exceptions (4) exercises (6) Getting Started (18) Groovy (2) hadoop (4) hibernate (77) hibernate interview questions (6) History (1) Hot book (4) http monitoring (2) Inheritance (4) intellij (1) java 8 notes (4) Java 9 (1) Java Concepts (7) Java Core (4) 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 (4) Java Programmer 2 (2) Javascript Frameworks (1) Java SE Professional (1) JSP (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) Quizzes (17) references (2) resources (1) restful web service (3) Searching (1) security (10) Servlets (8) Servlets and JSP (31) Sorting (1) source code management (1) spring (4) spring boot (1) Spring Examples (1) Spring Features (1) spring jpa (1) Stack (1) Streams & IO (3) Strings (11) SW Developer Tools (2) testing (1) user interface (1) vxml (8) web services (1) Web Technologies (1) Web Technology Books (1) youtube (1)