0 Replies Latest reply on Feb 11, 2010 6:18 AM by Denis Sborets

    The problem with Exception Handling and esb<->bpm variables mapping

    Denis Sborets Newbie

      Hi All.

       

      Can anybody help me with the next issue I have?

       


      I try to do next:

       

      1. I need to intercept exception inside ESB service, analyze exception,  add some parameter  to message body (e.g. my own error code, error description)

      2. I need to have access for that parameters in the BPM, after current node forward me to another, for the reason exception transition.

       

      The main problem is. It seems after exception BPM doesn't copy main body and parameters from esb to bpm's variables.... and maybe completely forget about output message.

       

      This is some chunks of my esb and bpm descriptions files:

       

      -------------------------bpm---------------------------------

        <node name="Save">
          <action class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
                  <esbCategoryName>
                      SampleCategory
                  </esbCategoryName>
                  <esbServiceName>
                      SaveData
                  </esbServiceName>
                  <bpmToEsbVars>
                      <mapping bpm="domainData" esb="domainData"/>
                  </bpmToEsbVars>
                  <esbToBpmVars>
                      <mapping esb="ERROR" bpm="ERROR_DESC"/>
                      <mapping esb="ERROR_CODE" bpm="ERROR_CODE"/>
                  </esbToBpmVars>
                  <exceptionTransition>exception</exceptionTransition>
              </action>
          <transition name="ok" to="Done"/>
          <transition name="exception" to="Error"/>
        </node>
      
      
        <node name="Error">
          <event type="node-enter">
              <script>
                      <expression>
                          java.lang.System.err.println(&quot;    ERROR      &quot;);
                      </expression>
      
              </script>
      
      
              <action class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
                  <esbCategoryName>SampleCategory</esbCategoryName>
                  <esbServiceName>CheckErrorDetails</esbServiceName>
                  <bpmToEsbVars>
                      <mapping bpm="ERROR_DESC" esb="ERROR"/>
                      <mapping bpm="ERROR_CODE" esb="ERROR_CODE"/>
                  </bpmToEsbVars>
              </action>
          </event>
          <transition name="to Error Save" to="ErrorSave"/>
        </node>
      
      -------------------------bpm---------------------------------

      -------------------------esb---------------------------------

       <service category="SampleCategory" name="SaveData">
                  <actions>
      
                       <action name="interceptor1" class="com.integration.actions.ExceptionHandlingAction">
                            <property name="exceptionMethod" value="catchesException" />
                            <property name="code" value="101" />
                            <property name="message" value="message3" />
                       </action>
      
                      <action class="com.integration.actions.SaveData" name="saveContact">
                         <property name="variables">
                     .........
                         </property>
                      </action>
      
                       <action name="interceptor2" class="com.integration.actions.ExceptionHandlingAction">
                            <property name="exceptionMethod" value="catchesException" />
                            <property name="code" value="102" />
                            <property name="message" value="message3" />
                       </action>
      
                      <action name="soapui-client-action" class="org.jboss.soa.esb.actions.soap.SOAPClient">
                         <property name="wsdl" value="..........................." />
                         <property name="responseAsOgnlMap" value="true" />
                         <property name="SOAPAction" value="Action"/>
                         <property name="LoggingMessages" value="true" />
                      </action>
      
                  </actions>
       </service>
      

       

      Each of "interceptor<N>" actions handle possible exception, add  ERROR and ERRO_CODE to the message.

       

      PBM show me error:

      [org.jbpm.graph.def.GraphElement] (JbpmJobExector:127.0.1.1:1) action threw exception: unable to resolve property: ERROR

      if there was an error in the "Save" node. And really, when, I try to see output message (without mapping in the "ERROR" node) I cannot see my parameters in the message.

       

      BTW.The main idea is: I need to know what happened, and get access for stacktrace inside another BPM node and another ESB service after exception.

       

      P.S. Thanks in advance for help