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.

1 comment:

Unknown said...

The variable "currentLine" is a variable that you keep updated through the execution? Or is it supposed to be a variable that's internal to SOA that you can access it?
When using your code I get a SelectionFailure trying to fetch the currentLine