GridLab
Grid Application Toolkit

A simple API for Grid Applications
GAT

Menu



next up previous contents
Next: WSDL Up: SOAP Previous: SOAP RPC Representation   Contents

Leonardo Da Vinci's Airplane Tickets


Now we know that this SOAP stuff is not for Ferrari washing, we can get to it and harness the power of SOAP to get us a trip to Paris. Let's assume that Leonardo has cracked open his brand-spanking new Titanium PowerBook G5, wired it up the the net, fired up a client program for a travel-booking system, filled in all the info for the trip, but has yet to pay for this vacation-cum-business trip. He, i.e. you, wants to complete this final task using this new fancy-pants SOAP RPC representation.

As the client program for a travel-booking system is already wired for SOAP you, i.e. Leonardo, don't have to open up the hood and go at the engine with a mallet to get the SOAP flowing. All you have to do is push a few GUI buttons and the SOAP will flow. None-the-less we still want to know what's going on behind the scenes, what our client is saying behind our backs to the travel-booking system.

If we were to peek in on the wire as the travel-booking client was using our credit card to pay for our vacation, I mean business trip, using the SOAP RPC representation we'd see a client request looking just like this

<?xml version='1.0' ?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" >
 <env:Header>
   <t:transaction
           xmlns:t="http://thirdparty.example.org/transaction"
           env:encodingStyle="http://example.com/encoding"
           env:mustUnderstand="true" >5</t:transaction>
 </env:Header>  
 <env:Body>
  <m:chargeReservation 
      env:encodingStyle="http://www.w3.org/2003/05/soap-encoding"
         xmlns:m="http://www.travelcompany.fr/">
   <m:reservation xmlns:m="http://www.travelcompany.fr/reservation">
    <m:code>FT35ZBQ</m:code>
   </m:reservation>   
   <o:creditCard xmlns:o="http://www.travelcompany.fr/financial">
    <n:name xmlns:n="http://www.travelcompany.fr/employees">
           Leonardo Da Vinci
    </n:name>     
    <o:number>123456789099999</o:number>
    <o:expiration>2005-02</o:expiration>
   </o:creditCard>
  </m:chargeReservation>
 </env:Body>
</env:Envelope>

In this example all the ducks of SOAP RPC representation are in a row. The URI of the ultimate SOAP receiver is the URI to which this message is being posted. The name of the remote procedure to be called is in this case chargeReservation. The chargeReservation procedure takes two arguments, one a reservation which takes value

<m:reservation xmlns:m="http://www.travelcompany.fr/reservation">
  <m:code>FT35ZBQ</m:code>
</m:reservation>

and one a creditCard which takes value

<o:creditCard xmlns:o="http://www.travelcompany.fr/financial">
  <n:name xmlns:n="http://www.travelcompany.fr/employees">
    Leonardo Da Vinci
  </n:name>     
  <o:number>123456789099999</o:number>
  <o:expiration>2005-02</o:expiration>
</o:creditCard>

The conversational format, however, is not specified in this missive. We'll assume, for the sake of this example, that this was specified out-of-band using a WSDL document. This WSDL document could, for example, specify that the travel-booking system respond with a URL where the details of the reservation can be viewed with a web browser. With this set-up the result returned from the travel-booking system would look a bit like this

<?xml version='1.0' ?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" >
 <env:Header>
     <t:transaction
        xmlns:t="http://thirdparty.example.org/transaction"
          env:encodingStyle="http://example.com/encoding"
           env:mustUnderstand="true">5</t:transaction>
 </env:Header>  
 <env:Body>
     <m:chargeReservationResponse 
         env:encodingStyle="http://www.w3.org/2003/05/soap-encoding"
             xmlns:rpc="http://www.w3.org/2003/05/soap-rpc"
               xmlns:m="http://www.travelcompany.fr/">
       <rpc:result>m:viewAt</rpc:result>
       <m:viewAt>
         http://www.travelcompany.fr/reservations?code=FT35ZBQ
       </m:viewAt>
     </m:chargeReservationResponse>
 </env:Body>
</env:Envelope>

As the return value of a SOAP RPC call can contain many SOAP body sub-elements there needs to be some way of indicating which of these elements is the return value. The element result has this as its task. It's contents indicate the name of the SOAP body sub-element which contains the return value. In our example it indicates that the return value is found in the element with the name m:viewAt. So, the return value is

http://www.travelcompany.fr/reservations?code=FT35ZBQ

With this the plans are laid and Leonardo can grab some much needed face-time with the King.


next up previous contents
Next: WSDL Up: SOAP Previous: SOAP RPC Representation   Contents
Andre Merzky 2004-05-13