I've been cataloging the GXA specifications and trying to provide my own roadmap to what's happening in that area. I've created an index to the articles under "Global XML Web Services Architecture." Today, the topic is the web service routing specification.
WS Routing provides an extension to the SOAP envelop for describing the route that a particular message should take. The protocol can be used to describe the ordered path from the originator of the message, through multiple intermediaries to the final destination. For example, in the following diagram, A is the originator, D is the receiver, and B and C are the intermediaries.
The WS Routing specification defines a "path" element that can be added to the header of a SOAP message in much the same way that the security elements are added in the WS Security specification. The path element can contain:
- a "from" element for the message originator (A),
- a "to" element for the final destination (D),
- a "fwd" element to contain the forward message path for the intermediaries, and
- a "rev" element to contain the reverse message path.
This example (taken from the Microsoft page describing WS Routing) shows a SOAP envelop that contains a path element describing the picture shown above.
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2001/06/soap-envelope"> <SOAP-ENV:Header> <wsrp:path xmlns:wsrp="http://schemas.xmlsoap.org/rp/"> <wsrp:action>http://www.im.org/chat</wsrp:action> <wsrp:to>soap://D.com/some/endpoint</wsrp:to> <wsrp:fwd> <wsrp:via>soap://B.com</wsrp:via> <wsrp:via>soap://C.com</wsrp:via> </wsrp:fwd> <wsrp:from>soap://A.com/some/endpoint</wsrp:from> <wsrp:id>uuid:84b9f5d0-33fb-4a81-b02b-5b760641c1d6</wsrp:id> </wsrp:path> </SOAP-ENV:Header> <SOAP-ENV:Body> ... </SOAP-ENV:Body> </SOAP-ENV:Envelope>
All in all, the idea and the execution are pretty straightforward, much like the WS Security specification. There are a couple of important points
- The SOAP message contains the route, so the message can be routed independently without any intermediary having to refer to or be in communication with the originator or any other central coordinator. Once the message is on its way, each intermediary can get it to the next recipient on its own.
- A corollary to the last point is that the SOAP message is, as it was before the insertion of the "path" element, transport neutral. This means that each intermediary is free to choose whatever transport is available or best for getting the message to the next recipient. So, in the example given above, A could send the message to B using HTTP, B could send it to C using Jabber, and C could send it to D using SMTP.
- The "rev" element is constructed as the message is moved along. Each node moves its "via" element from the "fwd" element to the "rev" element.
- The example given above shows a static route, but the WS Referral specification provides a mechanism for dynamically discovering the route. I'll cover that next.
- In keeping with the modular nature of the GXA specifications, the WS Routing specification is not concerned with security, reliability, retransmission, transactions, etc. These are handled by other components in the GXA family.