W3C home > Mailing lists > Public > www-ws-desc@w3.org > April 2005

Re: HTTP Binding example for the Primer

From: Arthur Ryman <ryman@ca.ibm.com>
Date: Fri, 8 Apr 2005 23:37:16 -0400
To: "David Orchard" <dorchard@bea.com>
Cc: www-ws-desc@w3.org, www-ws-desc-request@w3.org
Message-ID: <OF9217970A.4AC7A997-ON85256FDD.0080ABDB-85256FDE.0013E2B8@ca.ibm.com>
David,

Great examples. Would you like to contribute them to the Test Suite? If 
so, please split these up into XSD valid files and post them to the 
mailing list. I'll extract them and check them into the Test Suite.

Arthur Ryman,
Rational Desktop Tools Development

phone: +1-905-413-3077, TL 969-3077
assistant: +1-905-413-2411, TL 969-2411
fax: +1-905-413-4920, TL 969-4920
mobile: +1-416-939-5063, text: 4169395063@fido.ca
intranet: http://labweb.torolab.ibm.com/DRY6/



"David Orchard" <dorchard@bea.com> 
Sent by: www-ws-desc-request@w3.org
03/31/2005 07:15 PM

To
<www-ws-desc@w3.org>
cc

Subject
HTTP Binding example for the Primer






I've created a bunch of examples for the Primer.  A checkAvailability GET, 
ReservationDetails GET and PUT, and 2 forms of ReservationList GET.  This 
shows GETs and PUTs, as well as using a query type for use in a URI.  My 
apologies for not putting this into xml-spec nor providing perhaps the 
most complete examples or text, but at least the content is there.
 
4.3.3 Extensions for  HTTP Binding
 
As mentioned in section 2.5, WSDL 2.0 offers great flexibility in binding 
to SOAP message formats as well as HTTP.  The GreatH service can be 
deployed to HTTP such that an HTTP GET can return the flight availability, 
as shown below:
 
  <binding name="reservationHTTPBinding" 
      interface="tns:reservationInterface"
      whttp:methodDefault="GET">
 
  <operation ref="tns:opCheckAvailability"
    whttp:location="{tCheckAvailability}"  >
 
  </binding>
 
  <service name="reservationService" 
    interface="tns:reservationInterface">
 
    <!-- HTTP 1.1 GET End Point -->
    <endpoint name="reservationEndpoint" 
      binding="tns:reservationHTTPBinding"
      address="http://greath.example.com/2004/"/>
 
 
The default Binding Rules for HTTP specify that the default input 
serialization for GET is application/x-www-form-urlencoded.  A sample URI 
is
http://greath.example.com/2004/?checkInDate=5-5-5&checkOutDate=6-6-5&roomType=foo
 
Each of the elements in the tCheckAvailability type is serialized into the 
query parameters.
 
It is also possible to serialize a subset of the tCheckAvailability type 
by using appending a "/" in the whttp:location, as in:
 
<operation ref="tns:opCheckAvailability"
    whttp:location="bycheckInDate/{checkInDate/}"  >
 
This serializes to http://greath.example.com/2004/bycheckInDate/5-5-5. 
 
5.11.3 Reservation Details Web Service using HTTP transfer
 
As each reservation has a distinct URI, the Reservation Details Web 
service can be offered using HTTP GET and HTTP PUT.
 
<binding name="reservationDetailsHTTPBinding"
        interface="tns:reservationDetailsInterface"
 
        <operation ref="tns:retrieve"
            whttp:method="GET" />
 
        <operation ref="tns:update"
            whttp:method="PUT" />
 
    </binding>
 
As with the earlier examples, a service and endpoint elements are not 
provided because the reservation List Web service provides the endpoints. 
 
5.11.4 Reservation List Web service using HTTP GET
 
The SOAP version of the Reservation List offers 4 different search 
operations.  These can also be expressed as various parameters in a URI 
used by HTTP Get.
 
<binding name="reservationListHTTPBinding"
        interface="tns:reservationListInterface"
        whttp:methodDefault="GET">
 
        <operation ref="tns:retrieve"
            whttp:location="" />
 
        <operation ref="tns:retrieveByConfirmationNumber"
            whttp:location="/ConfirmationNumber/{confirmationNumber/}" />
 
        <operation ref="tns:retrieveByCheckInDate"
            whttp:location="/CheckInDate/{checkInDate/}" />
 
        <operation ref="tns:retrieveByCheckOutDate"
            whttp:location="/CheckOutDate/{checkOutDate/}" />
 
    </binding>
 
    <endpoint name="reservationListEndpoint"
            binding="tns:reservationListHTTPBinding"
            address="http://greath.example.com/2004/reservationList" />
 
 
A retrieval by Confirmation Number URI would look like 
http://greath.example.com/2004/reservationList/ConfirmationNumber/HSG635
 
 
Alternatively, a single Query type may be provided.  This query type is a 
sequence of optional items.  Any items in the sequence are serialized into 
the URI query string.  A query sequence for any of ConfirmationNumber, 
checkInDate, checkOutDate is
 
<element name="reservationQuery">
        <annotation>
            <documentation>
                A reservation contains the confirmation number, check-in
                and check-out dates, and a reference to a Reservation
                Details Web service.
            </documentation>
        </annotation>
        <complexType>
            <sequence>
                <element ref="details:confirmationNumber" minOccurs="0"/>
                <element ref="details:checkInDate" minOccurs="0"/>/>
                <element ref="details:checkOutDate" minOccurs="0"/>/>
            </sequence>
            </sequence>
        </complexType>
    </element>
 
The WSDL service that offers this type serialized as a parameter is:
 
<interface name="reservationListInterfaceWithQuery">
 
        <operation name="retrieveByReservationQuery"
            pattern="http://www.w3.org/2004/03/wsdl/in-out">
            <input messageLabel="In"
                element="details:ReservationQuery" />
            <output messageLabel="Out" element="list:reservationList" />
        </operation>
 
    </interface>
 
<binding name="reservationListQueryHTTPBinding"
        interface="tns:reservationListInterfaceWithQuery"
        whttp:methodDefault="GET">
 
        <operation ref="tns:retrieveByReservationQuery"
            whttp:location="/{ReservationQuery}}" />
 
    </binding>
 
    <endpoint name="reservationListEndpoint"
            binding="tns:reservationListHTTPBinding"
            address="http://greath.example.com/2004/reservationList" />
 
 
Various URIs are
http://greath.example.com/2004/reservationList/ReservationQuery?confirmationNumber=HSG635
http://greath.example.com/2004/reservationList/ReservationQuery?checkInDate=06-06-05
 
It is important to observe that using the URI serialization can result in 
very flexible queries and few operations.  The previous discrete SOAP 
operations are collapsed into one "parameterized" operation.
 
 
 
Received on Saturday, 9 April 2005 03:37:25 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:58:35 GMT