Friday, January 7, 2011

oracle.xml.parser.v2.XMLElement, debugging and logging in BPEL

oracle.xml.parser.v2.XMLElement is the result of any XPath operation on a variable. Obvious, it's the way SOA Suite internally represents the payload and complex variables.

You can embed a Java activity like this:

oracle.xml.parser.v2.XMLElement currentLine = (oracle.xml.parser.v2.XMLElement)getVariableData("currentLine");     
     
System.out.println("currentLine=" + currentLine);



If you want to print the XML, here is how:

oracle.xml.parser.v2.XMLElement currentLine = (oracle.xml.parser.v2.XMLElement)getVariableData("currentLine");     
     
System.out.println("currentLine=" + currentLine);
addAuditTrailEntry("currentLine is: " + currentLine);

java.io.StringWriter writer = new java.io.StringWriter();
try {
  currentLine.print(writer);
  String payloadAsString = writer.toString();
  System.out.println("currentLine=" + payloadAsString);

}
catch (Exception e) {
  e.printStackTrace();
}




See also here for more on logging in BPEL.

No comments: