Spot the difference

1 minute read

Below are two SOAP messages that are only subtly different when you look at the XML text, but the way how they “want to be treated” at the endpoint differs quite dramatically. The first targets a data-item/record/object and triggers a method, while the second targets an interface/endpoint/API and triggers a function/procedure.

The first message carries an out-of-band reference that is in the header, the second has that same reference inside the body. The first is a bit like how the implicit “this pointer” argument is passed “invisibly” to a C++ or C# method, the second is like passing an explicit context argument in C or (classic) Pascal or any other procedural language. The first binds to logic belonging to a specific object, the second binds to some object-neutral handling logic.

 

 

[1]
<soap:Envelope xmlns:soap=”http://www.w3.org/2003/05/soap-envelope”
               xmlns:wsa=”http://schemas.xmlsoap.org/ws/2004/08/addressing”>
     <soap:Header>
           <wsa:To>http://www.example.org/Giro/Transfer</wsa:To>
           <my:Account xmlns:my=”http://schemas.newtelligence.com/2004/10/MyBank”>262616161</my:Account>
           <wsa:Action>http://schemas.newtelligence.com/2004/10/MyBank/Giro/Transfer</wsa:Action>
            …
     </soap:Header>
     <soap:Body>
            <my:Transfer xmlns:my=”http://schemas.newtelligence.com/2004/10/MyBank”>
               <my:TransferDestination>
                   <my:AccountNo>99999999999</my:AccountNo>
                   <my:Recipient>Peter Sample</my:Recipient>
                   <my:RoutingCode codeType=”DE-BLZ”>00000000</my:RoutingCode>
                   <my:Destination>Sample Bank</my:Destination>   
               </my:TransferDestination>
               <my:Amount>100.78</my:Amount>
               <my:Currency>EUR</my:Currency>
               <my:TransferDate>2004-10-27</my:TransferDate>
               <my:ValueDate>2004-10-27</my:ValueDate>
            <my:Transfer>
     </soap:Body>
</soap:Envelope>


[2]
<soap:Envelope xmlns:soap=”http://www.w3.org/2003/05/soap-envelope”
               xmlns:wsa=”http://schemas.xmlsoap.org/ws/2004/08/addressing” >
     <soap:Header>
            <wsa:To>http://www.example.org/Giro/Transfer</wsa:To>
            <wsa:Action>http://schemas.newtelligence.com/2004/10/MyBank/Giro/Transfer</wsa:Action>
            …
     </soap:Header>
     <soap:Body>
            <my:Transfer xmlns:my=”http://schemas.newtelligence.com/2004/10/MyBank”>
               <my:Account>262616161</my:Account>
               <my:TransferDestination>
                   <my:AccountNo>99999999999</my:AccountNo>
                   <my:Recipient>Peter Sample</my:Recipient>
                   <my:RoutingCode codeType=”DE-BLZ”>00000000</my:RoutingCode>
                   <my:Destination>Sample Bank</my:Destination>   
               </my:TransferDestination>
               <my:Amount>100.78</my:Amount>
               <my:Currency>EUR</my:Currency>
               <my:TransferDate>2004-10-27</my:TransferDate>
               <my:ValueDate>2004-10-27</my:ValueDate>
            <my:Transfer>
     </soap:Body>
</soap:Envelope>

 

 

A possible endpoint reference (“object pointer” in OOldspeak) for the message target for [1] is

 

<wsa:EndpointReference xmlns:wsa=”http://schemas.xmlsoap.org/ws/2004/08/addressing” >
    <wsa:Address>http://www.example.org/Giro/Transfer</wsa:Address>

    <wsa:ReferenceParameters>
         <my:Account xmlns:my=”http://schemas.newtelligence.com/2004/10/MyBank”>262616161</my:Account>
    <wsa:ReferenceParameters> 

    ...
<wsa:EndpointReference>


A possible endpoint reference for [2] is

 

<wsa:EndpointReference xmlns:wsa=”http://schemas.xmlsoap.org/ws/2004/08/addressing” >
    
<wsa:Address>http://www.example.org/Giro/Transfer</wsa:Address>

<wsa:EndpointReference>

 

I am sure it’s boring to everybody else, but I find it quite funny how WS-Addressing turns out to be the “Object Access Protocol” for SOAP ;-)

Updated:

Leave a Comment