Split Transactions on Java XML Binding

You can identify transactions for Java XML data binding frameworks for these types of frameworks:

  • Castor
  • JAXB
  • JibX
  • XMLBeans
  • XStream

In the following example, the posted XML is unmarshalled to the PurchaseOrderDocument getOrderType()

<acme>
<order>
<type>creditcard</type>
<item>Item1</item>
<item>Item2</item>
<item>Item3</item>
</order>
</acme>

The following snippet shows the doPost()

public void doPost(HttpServletRequest req, HttpServletResponse resp) {
PurchaseOrderDocument poDoc = PurchaseOrderDocument.Factory.parse(po);
PurchaseOrder po = poDoc.getPurchaseOrder();
String orderType = po.getOrderType();
//read all the items
processOrder(orderType,items)
...
}

To split the transaction based upon the XML Binding:

  1. On the Rule Configuration tab, checkSplit transactions using XML/JSON Payload or a Java method invocation.
  2. SelectJava XML Bindingas the split mechanism.
  3. Enter these values for the match criteria:
    • Unmarshaled Class Name: PurchaseOrderDocument
    • Method name: getOrderType()

The agent identifies the business transaction for this example as Store.order.creditcard

This custom rule ensures that the Java agent intercepts the method in XMLBeans (which unmarshalls XML to Java objects). If the name of the transaction is not on a first level getter on the unmarshalled object, you can also use a recursive getter chain such as getOrderType().getOrder()

Although the transaction name is not obtained until the XML is unmarshalled, the response time for the transaction is calculated from the doGet()