What's the difference between <binding> and <portType> in WSDL?
portType (Analogs to Java interface)
- PortType is an abstraction part of WSDL.
- An abstract set of operations supported by one or more endpoints.
binding
- Binding is an concrete part of WSDL.
- Describes how the operation is invoked by specifying concrete protocol and data format specifications for the operations and messages.
SOAP Binding:
SOAP binding allows eitherdocument
orrpc
style with eitherencoding
orliteral
. Encoding indicates how a data value should be encoded in an XML format (These rules specify how "something" is encoded/serialized to XML and then later decoded/de-serialized from XML back to "something"). Literal means that the data is serialized according to a schema (this is just plain XML data). With transportation type http, jms, smtp...HTTP GET & POST binding:
WSDL includes a binding for HTTP 1.1's GET and POST verbs in order to describe the interaction between a Web Browser and a web site.MIME binding: WSDL includes a way to bind abstract types to concrete messages in some MIME format.
In WSDL 2.0 :
- PortTypes renamed to interfaces
- Ports renamed to endpoints
- Removed message constructs
Useful links
Interfaces (wsdl:portType)
The WSDL portType element defines a group of operations (sometimes known as an interface).
The operation elements contain a combination of input and output elements. There can be a fault element when you have an output element. The order of these elements defines the message exchange pattern (MEP) (One-way, Request – Response, etc)
wsdl:binding
The WSDL binding element describes the concrete details of using a particular portType with a given protocol.
PortType defines the abstract interface of a web service.
Conceptually it is like a Java interface since it defines an abstract type and related methods.
In WSDL the port type is implemented by the binding and service elements which indicate the protocols, encoding schemes etc to be used by a web service implementation
I.e. the binding specifies concrete implementation details and essentially maps a portType to a set of protocols (HTTP and SOAP) message styles (Document/RPC) and encodings (literal)
Is the distiction clear now?