I'm currently learning the WSDL 2.0 specification and examining the example provided by http://www.w3.org/TR/wsdl20-primer/#basics-service
<interface name = "reservationInterface" >
. . .
</interface>
<binding name="reservationSOAPBinding"
interface="tns:reservationInterface"
. . . >
. . .
</binding>
<service name="reservationService"
interface="tns:reservationInterface">
<endpoint name="reservationEndpoint"
binding="tns:reservationSOAPBinding"
address ="http://greath.example.com/2004/reservation"/>
</service>
Here you can see that in service
declaration we have to specify interface
attribute, though it was already specified in the binding
declaration. So having binding name - we could resolve the interface name it implements. From my point of view (the person who doesn't know the specification yet) - it's just a data duplication.
The question: what is the interface
in service
specified for? Is there any practical reason for that?
I'm not very familiar with the WSDL 2.0 specification (WSDL 1.1 is still the de facto way of describing web services) but I think this is actually backwards. The <service>
needs the interface
attribute while the one on the <binding>
is optional.
http://www.w3.org/TR/wsdl20-primer/#basics-service (emphasis mine):
A WSDL 2.0 service specifies a single interface that the service will support, and a list of endpoint locations where that service can be accessed. Each endpoint must also reference a previously defined binding to indicate what protocols and transmission formats are to be used at that endpoint. A service is only permitted to have one interface.
http://www.w3.org/TR/wsdl20-primer/#more-bindings-reusable (emphasis mine):
A binding can either be reusable (applicable to any interface) or non-reusable (specified for a particular interface). [...] To define a reusable binding, the binding element simply omits the interface attribute and omits specifying any operation-specific and fault-specific binding details. Endpoints can later refer to a reusable binding in the same manner as for a non-reusable binding. Thus, a reusable binding becomes associated with a particular interface when it is referenced from an endpoint, because an endpoint is part of a service, and the service specifies a particular interface that it implements.
As I understand it, you need the interface
on the <service>
to specify which interface is being implemented, while the interface
on the <binding>
limits it's usage to that interface only. It seems kinda redundant when both are specified but they are used for different things.