1 Reply Latest reply on Apr 1, 2013 5:02 PM by 450652

    Need to reterive the payload from SOA-INFRA dehydration tables.

      Hi gurus,

      I've raised couple of SRs with Oracle and did not got appropriate response. So I think there are a lot of g8 minds also working here.


      I need to reterive the payload in the xml format and store in a db table for certain process.

      Steps followed:

      Created a soa process which accepts the InstanceId and ECID as input and provides them to a java class using Java embed activity. The class that accepts that input and connect to getCompositeInstances() using a locator class. In this process it will make use of another two classes to convert the instance payload to dom and then to display. The mainclass uses the XMLUtil and XPathUtils classes for this requirement.

      When I ran the three classes then I'm able to get the payload, but when called using the Javaembed I'm running into trouble. I'm getting a null value, not even any exception. I tried removing the catch in all the classes but no luck. Please find the below code in the Java embed and the java classes also.

      Code in Java Embed:

      setCompositeInstanceTitle("Composite HelloWorld123");
      String ecid =(String) getVariableData("Input_java_ecid");
      String compInstanceId =(String) getVariableData("Input_Java_instanceid");
      addAuditTrailEntry("Payload_ecid is: " + ecid);
      addAuditTrailEntry("Payload_insta is: " + compInstanceId);

      Blob2String.MainClass mc = new Blob2String.MainClass();
      String inputPayload = mc.getCompositeInstancePayload(compInstanceId, ecid);
      if(inputPayload == null)
      addAuditTrailEntry("inputPayload is*********"+inputPayload+".........");
      InsertIntoDB ir = new InsertIntoDB();
      ir.InsertMethod1(inputPayload,compInstanceId,ecid) ;
      /*//addAuditTrailEntry("Payload is: " + inputPayload);
      String StringPayload =(String)inputPayload;

      addAuditTrailEntry("StringPayload is: " + StringPayload);
      setVariableData("Java_Payload", StringPayload); */

      catch(Exception e)
      addAuditTrailEntry("Exception is: " + e);

      Code in MainClass:

      package Blob2String;

      import java.util.*;

      import javax.naming.Context;
      import oracle.soa.management.facade.ComponentInstance;
      import oracle.soa.management.facade.CompositeInstance;
      import oracle.soa.management.facade.Locator;
      import oracle.soa.management.facade.LocatorFactory;
      import org.w3c.dom.*;
      import oracle.soa.management.util.*;
      import oracle.fabric.common.*;
      import oracle.fabric.logging.*;
      import oracle.fabric.logging.BaseMessageBundle;

      public class MainClass {
      /* public MainClass() {

      public String getCompositeInstancePayload(String compInstanceId,String ecid)
      String compositeName="GetOpenCompositeInstances";
      Hashtable jndiProps = new Hashtable();
      String inputPayload="";

      Locator locator = LocatorFactory.createLocator(jndiProps);
      CompositeInstanceFilter filter = new CompositeInstanceFilter();
      filter.setECID(ecid);//Set the composite ECID
      filter.setId(compInstanceId);//Set the composite instance id
      List<CompositeInstance> compositeInstance = locator.getCompositeInstances(filter);
      ComponentInstanceFilter instanceFilter = new ComponentInstanceFilter();
      instanceFilter.setCompositeInstanceId (compInstanceId); //Set the composite instance id
      List<ComponentInstance> componentInstance = compositeInstance.get(0).getChildComponentInstances(instanceFilter);
      if (compositeInstance.size() > 0) {
      Document docAudit = XMLUtil.convertToDOM(componentInstance.get(0).getAuditTrail().toString());
      String payloadAudit = XPathUtils.executeXPath(docAudit, "//details").toString();
      Document docPayload = XMLUtil.convertToDOM(payloadAudit);
      Node payloadNode = XPathUtils.executeXPath(docPayload, "//part//*", "NODE");
      inputPayload = XMLUtil.nodeToString(payloadNode);
      catch(Exception e){
      // e.printStackTrace();

      return inputPayload;

      public static void main(String[] args){

      MainClass Obj = new MainClass();
      String result=Obj.getCompositeInstancePayload("60004" , "d90df5a0fd2bc5c7:4d37316b:13da0ebcf67:-8000-00000000000003ca") ;
      //String result=Obj.getCompositeInstancePayload("16952862" , "ef14bd96767c0e08:-152cfeeb:13d2379cff3:-8000-000000000008c968") ;
      // System.out.println(result);


      /* */


      Code in XMLUtil:

      package Blob2String;

      import org.xml.sax.InputSource;
      import java.io.*;
      import javax.xml.parsers.*;
      import javax.xml.transform.*;
      import javax.xml.transform.*;
      import javax.xml.transform.dom.DOMSource;
      import javax.xml.transform.stream.StreamResult;
      import org.w3c.dom.*;
      import org.xml.sax.InputSource;
      import oracle.fabric.logging.*;

      public class XMLUtil {
      * @param inputXML
      * @return
      * @throws Exception
      public static Document convertToDOM(String inputXML) throws Exception {
      Document dom = null;
      try {
      DocumentBuilderFactory factory =
      DocumentBuilder builder = factory.newDocumentBuilder();
      //DocumentBuilder builder = new org.apache.xerces.jaxp.DocumentBuilderFactoryImpl().newDocumentBuilder();
      InputSource is = new InputSource(new StringReader(inputXML));
      dom = builder.parse(is);
      } catch (Exception ex) {
      throw ex;
      return dom;

      public static String nodeToString(Node node) throws Exception{
      StringWriter sw = new StringWriter();
      try {
      Transformer t = new org.apache.xalan.processor.TransformerFactoryImpl().newTransformer();
      t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
      t.setOutputProperty(OutputKeys.INDENT, "yes");
      t.transform(new DOMSource(node), new StreamResult(sw));
      } catch (TransformerException te) {
      System.out.println("nodeToString Transformer Exception");
      throw te;
      return sw.toString();


      Code in XPathUtils :

      package Blob2String;

      import javax.xml.xpath.*;
      import org.w3c.dom.*;
      import oracle.fabric.logging.*;

      public class XPathUtils {
      public static Object executeXPath(Document doc, String xpathStr) throws Exception{
      XPath xpath = null;
      String value = null;
      try {
      XPathFactory factory = XPathFactory.newInstance();
      XPath xpath1= factory.newXPath();
      //xpath = new org.apache.xpath.jaxp.XPathFactoryImpl().newXPath();
      XPathExpression expr = xpath1.compile(xpathStr);
      value = (String)expr.evaluate(doc, XPathConstants.STRING);
      return value;
      } catch (Exception e) {
      throw e;
      public static Node executeXPath(Document doc, String xpathStr,String type) throws Exception{
      XPath xpath = null;
      Node value = null;
      try {
      xpath = new org.apache.xpath.jaxp.XPathFactoryImpl().newXPath();
      XPathExpression expr = xpath.compile(xpathStr);
      value = (Node)expr.evaluate(doc, XPathConstants.NODE);
      return value;
      } catch (Exception e) {
      throw e;

      Its an urgent issue and I have the deadline to get on with. I've raised SR with oracle but there was no use. Kindly help me. Help will be greatly appreciated.

        • 1. Re: Need to reterive the payload from SOA-INFRA dehydration tables.
          are you trying to retreive the payload for a completed/closed instance or for an inflight instance? if it is for inflight instance you can retreive the payload using
          String [] params = new String[] {"inputVariable"};
          String payload = locator.executeComponentInstanceMethod(bpelInstanceId, "getVariableAsString", params);

          if it is for a completed instance, you need to get the input payload for the instance then you can get it from the audit trail. i think your xpath is not correct. the data in details look like this:

          </event><event sid="BpSeq0.3" cat="2" wikey="2020-BpRcv0-BpSeq0.3-1" state="5" n="4" label="receiveInput" date="2013-03-25T13:14:05.428-07:00" type="2"><message><![CDATA[Received "process" call from partner "client"]]></message><details><![CDATA[
          <input><part name="payload" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><ns1:input xmlns:ns1="http://samples.otn.com/bpel2.0/ch10.7">7</ns1:input></part></input>]]></details>

          you need extract the CDATA content and parse again. this query needs to be changed, there could be many details in the audit trail, you need to pick the right one.
          XPathUtils.executeXPath(docAudit, "//details").toString();

          this audit xml is namespace aware so you need to use this, choose the first details.
          public static NodeList selectNodes( org.w3c.dom.Element pElement,
          String xpathExpression,
          Map prefixNamespaceMapping ) throws Exception

          Edited by: murugac on Apr 1, 2013 10:00 AM