Thursday, November 10, 2011

Retrieve BPEL payload from the database

Given an instance id, how to get the payload used to invoke the BPEL, from the dehydration database (called SOA infrastructure database in 11G)?

You have two options, each with its pros and cons:

Option 1. Extract payload from process instance data (i.e. "cube instance")
  • Lookup instance handle using conversation Id or instance Id
  • Call the"bpelVariableName") API to get the payload. If the variable is a message type, the returned object is a Map and you can get the Element via map.get("partName"). If the variable is an element type, the returned object is an Element object.

  • If your BPEL process change the value of the input variable, this API It will get the latest value, not the initial one.
  • It may not be able to get the variables from the faulted instances. It may only work with successful instances

Option 2. Extract payload from audit trail
  • Lookup instance handle using conversation Id or instance ID
  • Fetch audit trail from instance handle using IInstanceHandle.getAuditXXX() API
  • Use substring functions to extract initiating payload

  • You need to do your own parsing of XML in order to extract the initial payload
  • If you use auditLevel to dial down the audit trail to a certain degree, or even totally suppress it, you may not be able get the payload from audit trail


  1. Interesting. But there are other ways around as well. For instance directly sql quering the dehydration database. Off course the Audit trail entry is encoded but a simple decoder functionality gives you the entire XML payload for an instance.

    1. Thank you for the input. Would you mind post your sample code here?

    2. Hi Francis, this is useful bit of tool to have, Arun I am having to rely on the dehydration database queries a lot, however I haven't seen the Actual XML payload so far...
      Can you send me a few of these queries and the decoder link etc ...
      Thanks in advance.