Sunday, June 2, 2013

How to log from within a BPEL process

There are multiple ways to log information from a BPEL process to the server logfile.

One options is to write your own extension activity and use it to log information to the log where necessary. However, there is a simple and easy way to write logs without writing your own extension. That is to use the E4X extension activity.

In order to use E4X extension within your bpel process, follow the following steps.

1. Add xpath 2.0 namespaces to the process definition.

queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"

2. Define e4x as an extension.

<bpel:extensions>
  <bpel:extension namespace="http://ode.apache.org/extensions/e4x" mustUnderstand="yes"/>
</bpel:extensions>

3. Include the e4x extension operation where you want to log information.

   <bpel:assign validate="no" name="AssignE4X">
      <bpel:extensionAssignOperation>
         <js:snippet xmlns:js="http://ode.apache.org/extensions/e4x">
           <![CDATA[ print(“My Log message from bpel process");  ]]>
         </js:snippet>
       </bpel:extensionAssignOperation>
   </bpel:assign>

No comments:

Post a Comment