03 - WSDL 2.0 Description Element

The description element is the root for any element in a WSDL 2.0 file. It is common to define within opening tag of the description element a set of namespaces that will be used throughout the document.

The following is an example of a description element of a WSDL 2.0 file:

<?xml version="1.0" encoding="utf-8" ?>
<description
    xmlns = "http://www.w3.org/ns/wsdl"
    targetNamespace = "http://yoursite.com/MyService"
    xmlns:tns = "http://yoursite.com/MyService"
    xmlns:stns = "http://yoursite.com/MyService/schema"
    xmlns:wsoap = "http://www.w3.org/ns/wsdl/soap"
    xmlns:soap = "http://www.w3.org/2003/05/soap-envelope"
    xmlns:wsdlx = "http://www.w3.org/ns/wsdl-extensions">
</description> 

In the previous example, each name spaces are detailed as follows:

xmlns = "http://www.w3.org/ns/wsdl"

This is the XML namespace for WSDL 2.0 itself. Use this attribute for setting the default namespace of the description element. It will be applied to all elements inside the description element unless they explicitly declare a different namespace, in other words any element without a prefix are expected to be WSDL 2.0 elements.

targetNamespace = "http://yoursite.com/MyService"

Use this attribute to define the namespace of your web service. You could choose any namespace for this, but it is a convention to use the URI pointing to the WSDL of the service.

xmlns:tns = "http://yoursite.com/MyService"

Use this to declare a prefix for the targetNameSpace. This attribute should be set the same as the targetNameSpace, using the same URI. By means of this you can refer to the target namespace by using this namespace prefix (tns).

xmlns:stns = "http://yoursite.com/MyService/schema"

Use this to declare the Schema Target Name Space URI. This should point to the URI of the XML schema’s namespace. This will be used in the types element of your WSDL for declaring your web service types.

xmlns:wsoap = "http://www.w3.org/ns/wsdl/soap"

Use this to declare the WSDL SOAP URI. You will be using this namespace in the binding element of your WSDL.

xmlns:soap = "http://www.w3.org/2003/05/soap-envelope"

Use this to declare the SOAP URI of the SOAP version that will be declaring the in the web service described by your WSDL.

xmlns:wsdlx = "http://www.w3.org/ns/wsdl-extensions"

Use this to declare your WSDL Extensions URI.

Like us on Facebook