HTTP Bindings

Hello, 

While learning WSDL I encountered lot of examples dealing with SOAP bindings. However, I need
to use HTTP bindings but I did not manage to find any examples
except the one provided in [1]. The most problems I encounter
relate to the notion of port which seams to be a bit different for
HTTP then for SOAP.


I exemplify my doubts with some examples. I would appreciate your
feedback.

I want to describe a service  with 2 methods: the service
is called "math" and has the methods "multiply" and "divide".

* When publishing it via a SOAP interface I get a single URL (http://www.home.com/math) to
which 2 different SOAP operations can be sent. In WSDL this is
modelled by declaring a portType with 2 operations and then
binding the port to the URL.

<definitions .... >

    <portType name="MathPortType">
        <operation name="multiply">
        ...
        </operation>
        <operation name="divide">
        ...
        </operation>
    </portType>

    <binding name="MathBinding" type="tns:MathPortType">
        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
        <operation name="multiply">
            <soap:operation style="rpc" />
            ....
        </operation>
        <operation name="divide">
            <soap:operation style="rpc" />
            ....
        </operation>
    </binding>

    <service name="Math">
        <port name="MathPort" binding="MathBinding">
            <soap:address location="http://www.home.com/math" />
        </port>
    </service>

</definitions>

Generally, in SOAP I got the impression that a port is identified
with a URL. Further it groups together a set of operations that
can be invoked by sending a SOAP message to that URL.

* When publishing the service to be accessible via HTTP, I create
2 different URLs for each method:
http://www.home.com/math/multiply and
http://www.home.com/math/divide. Now I am confused about how to
describe this in WSDL. I have two ideas:

1) declare a portType with 2 operations (just like in SOAP). At
binding time bind the port to the baseURL and for each operation
specify the relative address. This seams the right way to do based
on the example in [1]. Also it feels right because conceptually
all these operations belong together. However it conflicts with
the SOAP scenario where each port is bound to a URL.

<definitions .... >
    <portType name="MathPortType">
        <operation name="multiply">
        ...
        </operation>
        <operation name="divide">
        ...
        </operation>
    </portType>

     <binding name="MathBinding" type="MathPortType">
       <http:binding verb="POST"/>
        <operation name="multiply">
          <http:operation location="multiply"/>
          ....
        </operation>
        <operation name="divide">
          <http:operation location="divide"/>
          ....
        </operation>
    </binding>

   <service name="Math">
        <port name="MathPort" binding="tns:MathBinding">
           <http:address location="http://www.home.com/math"/>
        </port>
    </service>

</definitions>


2) declare 2 portTypes each having an operation. At binding time
bind each port to the URL of the operation. This feels
conceptually not correct, but keeps the port=URL correspondence
that I am used to from SOAP.

<definitions .... >
    <portType name="MathPortTypeMultiply">
        <operation name="multiply">
        ...
        </operation>
    </portType>

    <portType name="MathPortTypeDivide">
        <operation name="divide">
        ...
        </operation>
    </portType>

     <binding name="MathBindingMultiply" type="MathPortTypeMultiply">
       <http:binding verb="POST"/>
        <operation name="multiply">
          <http:operation location=""/>
          ....
        </operation>
    </binding>

     <binding name="MathBindingDivide" type="MathPortTypeDivide">
       <http:binding verb="POST"/>
        <operation name="divide">
          <http:operation location=""/>
          ....
        </operation>
    </binding>

   <service name="Math">
        <port name="MathPortMultiply" binding="tns:MathBindingMultiply">
           <http:address location="http://www.home.com/math/multiply"/>
        </port>
        <port name="MathPortDivide" binding="tns:MathBindingDivide">
           <http:address location="http://www.home.com/math/divide"/>
        </port>
    </service>

</definitions>


Can you tell me which of these methods (if any) is correct? Is one
preferred to the other? Also, I'd appreciate any pointers to some
further HTTP examples or any material that would make this issue clearer.

Thank you,

Marta

[1] Web Services Description Language (WSDL) Version 1.2: Bindings
(http://www.w3.org/TR/2003/WD-wsdl12-bindings-20030124/)

-- 
 Marta Sabou

Received on Thursday, 27 February 2003 17:16:07 UTC