Wednesday, 15 July 2020

Receive and send WSA Properties in BPEL 2.0

Last week I had the honour to present on CorrelationSets in a Virtual Meetup, which is a feature that relates to the WS-Addressing support of SOA Suite.

At my current customer, I had to rebuild a BPEL Process from 1.1 to 2.0, to be able to split it up using embedded and reusable  subprocesses.

One requitement is to receive the wsa-Action property and reply it back, concatenated with 'Response'.

Since it implements a WSDL with 3 operations, I need a Pick-OnMessage construction.

To receive properties you can open the activity, in my case the OnMessage:
In the source his looks like the following:
<onMessage partnerLink="MyService_WS" portType="ns1:myService" operation="myOperation"
                 variable="MyService_InputVariable">
        <bpelx:fromProperties>
          <bpelx:fromProperty name="wsa.action" variable="wsaAction"/>
        </bpelx:fromProperties>
With the wsaAction variable here is based on xsd:string.

However, this turns out not to work: the wsaAction variable stays empty.
This turns out to be a bug, that should have been solved since 11.1.1.6, but apparently still works as is. Read more about it in support document 1345071.1.

Solution is simple: just remove the wsa. prefix:
<onMessage partnerLink="MyService_WS" portType="ns1:myService" operation="myOperation"
                 variable="MyService_InputVariable">
        <bpelx:fromProperties>
          <bpelx:fromProperty name="action" variable="wsaAction"/>
        </bpelx:fromProperties>
For invoke, reply, receive and other activities it works the same.

As said, in my case I need to reply with a wsa.action that is a concatenation of the received action with 'Response'. This can be done using an expression:
Again, first choose wsa.action and then in the source remove the wsa. prefix:
<reply name="ReplyMyService" partnerLink="MyService_WS" portType="ns1:myService"
                 variable="MyService_OutputVariable" operation="myOperation">
            <bpelx:toProperties>
              <bpelx:toProperty name="action">concat($wsaAction, 'Response')</bpelx:toProperty>
            </bpelx:toProperties>
            <bpelx:property name="action" variable="WSAction"/>
          </reply>
Testing this in SoapUI or ReadyAPI will show:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing">
   <env:Header>
      <wsa:Action>http://www.darwin-it.nl/my/myServiceResponse</wsa:Action>
      <wsa:MessageID>urn:1694440c-c69a-11ea-bc81-0050569796a9</wsa:MessageID>
      <wsa:ReplyTo>
...

For more info on setting properties, see the docs.


No comments:

Post a Comment