WSDL Definition Element

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="HelloWorldService"
   targetNamespace="https://www.dineshonjava.com/wsdl/HelloWorldService.wsdl"
   xmlns="http://schemas.xmlsoap.org/wsdl/"
   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
   xmlns:tns="https://www.dineshonjava.com/wsdl/HelloWorldService.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 HelloWorldService.
  • 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 https://www.dineshonjava.com/wsdl/HelloWorldService.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.

References
Wikipedia for WSDL

 

<<Previous <<   || Index ||   >>Next >>

Previous
Next