Search code examples
web-serviceswsdl

Difference between WSDL document and WSDL contract


I believe they are the same, a file in XML format as shown in the example below:

<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">

  //other code

</definitions>

Is there a difference between WSDL document and WSDL contract?


Solution

  • The difference is subtle. One refers to the WSDL itself (document), the other refers to what the WSDL represents (contract).

    WSDL is an XML format for describing web services. That XML content (saved in a file or not) represents the WSDL document. In a large sense, a document represents some structured information that you can use for something (e.g. you can have a Word document, a PDF document, an XML document and ... a WSDL document).

    The content of the WSDL document defines the contract of the web service: what operations it has, how you must call them, what parameters it expects, what types do the parameters have etc. Basically it states the contract that you must follow to be able to successfully interact with the web service.