Maarten Smeets posted a nice article describing asynchronous interaction in BPEL and BPM using WS-Addressing and correlation sets. I wanted to use Service Bus 12c to force the callback to go through a Service Bus proxy instead of going directly to the consumer. This can be useful when the target service should not have the ability to call services outsite of its trusted domain or network.
All sources can be found in my GitHub repository.
WS-Addressing
WS-Addressing provides a way for message routing and correlation using SOAP headers. It is an official specification. Service Bus, SOA Suite, JAX-WS and quite a lot of other frameworks and tools support it one way or the other. There are two versions of WS-Addressing: 200508 and 200408.
In an synchronous interaction the following headers are important:
- Request:
- ReplyTo
- MessageId
- Callback:
- RelatesTo
In the request the ReplyTo specifies the address where the reply must be send to (or http://www.w3.org/2005/08/addressing/anonymous if no reply address is specified). The MessageId headers contains a unique id which can be used to to correlate the request to a future callback. In the callback the RelatesTo header contains the original MessageId. There are others headers for example Action which are important, but for creating an asynchronous interaction ReplyTo, MessageId and RelatesTo are all that are required.
SOA Suite 11g and 12c support WS-Addressing (don’t mention SOA Suite 10g…) and provide out of the box correlation support. Using BPEL no code is required to use WS-Addressing for correlation (both as consumer and as producer).
Test scenario
A SOA composite will implement an asynchronous webservice (a fire & forget request followed by a future fire & forget callback). It will be exposed using a Service Bus project which will ‘hide’ the implementation for the outside world. For example the SOA composite might be running in a local domain, while the Service Bus project migt be running in a SOA CS cloud instance. This will allow to SOA composite to only receive traffic from ‘trusted’ networks and the Service Bus will handle all security.
This will be the test setup, where SoapUI will play the external consumer: Read the complete article here.
For regular information on Oracle SOA Suite become a member in the SOA & BPM Partner Community for registration please visit www.oracle.com/goto/emea/soa (OPN account required) If you need support with your account please contact the Oracle Partner Business Center.