Multiple-port Service Defined in a WSDL

15,979

Solution 1

Yes. Imagine in real life, this is indeed possible:

A Shipping Dock: The Idea of a Multi-Port Service

enter image description here

Please refer to Section 2.7 of the W3 WSDL Specification. You can see that the * signifies you can have multiple ports under a service. In fact, a service groups a set of related ports together. There are several points to note though.

Section 2.7 of the W3 WSDL Specification

A service groups a set of related ports together:

<wsdl:definitions .... >
    <wsdl:service name="nmtoken"> *
        <wsdl:port .... />*
    </wsdl:service>
</wsdl:definitions>

The name attribute provides a unique name among all services defined within in the enclosing WSDL document.

Ports within a service have the following relationship:

  • None of the ports communicate with each other (e.g. the output of one port is not the input of another).
  • If a service has several ports that share a port type, but employ different bindings or addresses, the ports are alternatives. Each port provides semantically equivalent behavior (within the transport and message format limitations imposed by each binding). This allows a consumer of a WSDL document to choose particular port(s) to communicate with based on some criteria (protocol, distance, etc.).
  • By examining its ports, we can determine a service's port types. This allows a consumer of a WSDL document to determine if it wishes to communicate to a particular service based whether or not it supports several port types. This is useful if there is some implied relationship between the operations of the port types, and that the entire set of port types must be present in order to accomplish a particular task.

Solution 2

  • Each port refers unique binding (can have multiple bindings)
  • Each binding can refer single portType
  • Multiple binding can refer same portType or different portType (can have multiple portTypes)
  • So, when we have multiple portTypes, we publishes multiple ports by referring bindings.
    enter image description here

img courtesy

Share:
15,979
user2021023
Author by

user2021023

Updated on June 05, 2022

Comments

  • user2021023
    user2021023 almost 2 years

    A different question, with the essential problem. At the end of my WSDL file.

    <wsdl:service name="Lighting">
        <wsdl:port name="SwitchPower" binding="tns:SwitchPower">
            <soap:address location="http://localhost:8080/Lighting/SwitchPower/" />
        </wsdl:port>
        <wsdl:port name="Dimming" binding="tns:Dimming">
            <soap:address location="http://localhost:8080/Lighting/Dimming/" />
        </wsdl:port>
    </wsdl:service>
    

    The same service with two ports. Is it right?

    If no, what are the rules of the specification?

  • user2021023
    user2021023 about 11 years
    Thank for your help. So no now i have two <binding> and two <portType> (Dimming and SwitchPower). I never saw example with that. It was my problem. But my Client want read my WSDL when there is only one port (Dimming or SwitchPower) in this service but not when there are both.