A WSDL provides a comprehensive technical description of your service. It describes what the service does (its operations and message formats), how to interact with it (its bindings and protocols), and where to find it (its endpoint URL). If you are providing a service, you should always provide a WSDL that describes it. If you are consuming a service, you use the WSDL to construct your client application.
A WSDL is machine-readable, so you can compile a WSDL to generate client stubs and server skeletons. Many SOAP frameworks also provide a utility to generate a WSDL from a code-based service interface (Java or .NET) or from a service implementation class. These WSDL emitters are useful when you are first learning about WSDL, but as you get more familiar with the technology, you should shift to a WSDL-first development methodology. Generating WSDLs from code often causes interoperability problems, especially if your application uses language-specific types. The generated WSDLs also result in a proliferation of service-specific schema types, and one of your goals in a SOA initiative is to reduce the number of types in your organization.
Assuming you are using WSDL 1.1, a WSDL consists of five parts:
- types: using XML Schema, this section specifies the data structures used by the service
- message: specifies the data structure that is used in a particular input, output, or fault message (each message references a structure specified in the types section)
- portType: specifies the service interface from a logical perspective -- defines a set of operations (methods), and for each operation specifies the input, output, and fault messages that are exchanged for that operation (each operation references the messages described in the messages section
- binding: describes a concrete binding of an abstract service interface to a specific set of formats and protocols (a binding references the logical interface specified in a portType)
- service: specifies the physical endpoint that provides access to a particular binding for the service (a service port references a binding)
WSDL 2.0 changed the model a bit. The "message" section went away, and the "portType" section was renamed "interface". An interface defines its input, output, and fault messages, and references the schema data structures directly.
WSDL 2.0 is still quite new, and only a few SOAP frameworks support it at this time.
Dig Deeper on Topics Archive
Related Q&A from Anne Thomas Manes
Anne Thomas Manes explains the differences between open source clients and open source implementations. Continue Reading
Anne Thomas Manes discusses the best way to go about creating an enterprise data dictionary and why the systems works well. Continue Reading
Anne Thomas Manes explains the difference between 'hard' real time and 'live' real time systems. Continue Reading