Copyright © tutorialspoint.com

WSDL Definition Element

previous next


Advertisements

The <definition> element must be the root element of all WSDL documents. It defines the name of the web service.

Here is the example piece of code from last session which uses definition element.

<definitions name="HelloService"
   targetNamespace="http://www.examples.com/wsdl/HelloService.wsdl"
   xmlns="http://schemas.xmlsoap.org/wsdl/"
   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
   xmlns:tns="http://www.examples.com/wsdl/HelloService.wsdl"
   xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   ................................................
</definitions>

From the above example we can conclude the followings points:

  • The definitions element is a container of all the other elements.

  • The definitions element specifies that this document is the HelloService.

  • The definitions element specifies a targetNamespace attribute. The targetNamespace is a convention of XML Schema that enables the WSDL document to refer to itself. In this example we have specified a targetNamespace of http://www.examples.com/wsdl/HelloService.wsdl.

  • The definition element specifies a default namespace: xmlns=http://schemas.xmlsoap.org/wsdl/. All elements without a namespace prefix, such as message or portType, are therefore assumed to be part of the default WSDL namespace.

  • It also specifies numerous namespaces that will be used throughout the remainder of the document.

NOTE: The namespace specification does not require that the document actually exist at the given location. The important point is that you specify a value that is unique, different from all other namespaces that are defined.


previous next

Copyright © tutorialspoint.com