Tech and Media Labs
This site uses cookies to improve the user experience.

WSDL 2.0 - Overview

Jakob Jenkov
Last update: 2014-05-23

A WSDL file is an XML file describing the interface of a web service. A WSDL 2.0 file contains the following elements:

description The description element is the root element of the WSDL 2.0 file. All other WSDL elements are nested inside this element.
types The types element contains a specification of the data types exchanged between the client and the web service. By default these data types are described using XML Schema.
interface The interface element describes what operations the web service has, and what messages are exchanged for each operation (input / output). It also describes possible fault messages.
binding The binding element describes how the web service is accessed over the network. Typically the binding element binds the web service to the HTTP protocol.
service The service element describes where the web service can be accessed on the network. Typically the service element contains a URL to the service.
documentation The documentation element is optional and may contain a humanly readable description of the web service.
import The import element is optional and may be used to import XML Schemas or other WSDL files.

Each of these elements are explained in more detail in their own texts. See the top corner of this page for links to these texts.

Here is an outline of the required XML elements in a WSDL file:







WSDL Compared to Java Interfaces

Since WSDL describes the interface of a web service, I thought it might be useful for you to see how the XML elements in the WSDL match the declaration of a Java interface. That is what the diagram below shows. The orange boxes represent elements in the WSDL file.

WSDL compared to a Java interface.
WSDL compared to a Java interface. The orange boxes are WSDL elements.

As you can see, the Java classes (Input and Output) would be defined in the types element in WSDL. So would the exception. The method in the Java interface would be declared in an operation element inside the WSDL interface element. You'll see more examples on that in the interface text.

Full WSDL Example

Here is a full WSDL example:

<?xml version="1.0" encoding="utf-8" ?>
    xmlns=           ""
    targetNamespace= ""
    xmlns:tns=       ""
    xmlns:stns =     ""
    xmlns:wsoap=     ""
    xmlns:soap=      ""
    xmlns:wsdlx=     "" >

    This is the web service documentation.

        xmlns:xs=        ""
        targetNamespace= ""
        xmlns=           "">

      <xs:element name="latestTutorialRequest"

      <xs:complexType name="typeLatestTutorialRequest">
          <xs:element  name="date"   type="xs:date"/>

      <xs:element name="latestTutorialResponse" type="xs:string"/>

      <xs:element name="invalidDateError" type="xs:string"/>


  <interface  name = "latestTutorialInterface" >

    <fault name = "invalidDateFault"  element = "stns:invalidDateError"/>

    <operation name="latestTutorialOperation"
            wsdlx:safe = "true">

      <input    messageLabel="In"  element="stns:latestTutorialRequest" />
      <output   messageLabel="Out" element="stns:latestTutorialResponse" />
      <outfault messageLabel="Out" ref    ="tns:invalidDateFault" />


  <binding name="latestTutorialSOAPBinding"

    <fault ref="tns:invalidDateFault" wsoap:code="soap:Sender"/>

    <operation ref="tns:latestTutorialOperation"


       name     ="latestTutorialService"

     <endpoint name ="latestTutorialEndpoint"
            binding ="tns:latestTutorialSOAPBinding"
            address =""/>



Jakob Jenkov

Copyright  Jenkov Aps
Close TOC