Wednesday, December 16, 2009

WS-Addressing

Typically,  Web Services communicate over SOAP through Http. Since Http is stateless in nature, there can be a maximum of 1 complete conversation at a time. This suits well for short request-response messages where the conversation is complete. But for conversations that span multiple asynchronous or  synchronous message exchanges , there should be more information packed so that there is a callback information and a context for the message. This is standardized by the WS-Addressing specification by w3 which is available here

 
When an asynchronous process is invoked, the BPEL engine either invokes a new process or resumes a running process. It does this by looking at the Address information in the header of the SOAP message. A sample header can be seen below (it is taken from the w3 spec referred above).

 
Request
<S:Envelope xmlns:S="http://www.w3.org/2003/05/soap-envelope"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
<S:Header>
<wsa:MessageID>uuid:6B29FC40-CA47-1067-B31D-00DD010662DA </wsa:MessageID>
<wsa:ReplyTo>
<wsa:Address>http://business456.example/client1</wsa:Address>
</wsa:ReplyTo>
<wsa:To>http://fabrikam123.example/Purchasing</wsa:To>
<wsa:Action>http://fabrikam123.example/SubmitPO</wsa:Action>
</S:Header>
<S:Body>
...
</S:Body>
</S:Envelope>

 
Note that the request has ReplyTo as the response end point and the context for the conversation as MessageID.

 
Response
<S:Envelope xmlns:f123="http://www.fabrikam123.example/svc53">
<S:Header>
<wsa:MessageID>uuid:aaaabbbb-cccc-dddd-eeee-wwwwwwwwwww</wsa:MessageID>
<wsa:RelatesTo>uuid:6B29FC40-CA47-1067-B31D-00DD010662DA </wsa:RelatesTo>
<wsa:To S:mustUnderstand="1">
http://business456.example/client1
</wsa:To>
<wsa:Action>http://fabrikam123.example/mail/DeleteAck</wsa:Action>
</S:Header>
<S:Body>
<f123:DeleteAck/>
</S:Body>
</S:Envelope>

 
Note that the response has RelatesTo as the context for the conversation.

 
All additional message exchanges in this conversations only require the RelatesTo element as the BPEL engine can invoke the process instance with this information.

Other informative artciles

1 comment: