Skip to end of metadata
Go to start of metadata

The following illustration shows the situation in which an XML is posted to a Servlet. The Servlet uses an XML-to-Java binding framework, such as XMLBeans or Castor, to unmarshal and read the posted XML payload.

The XML payload contains the naming information for the transactions.

In the following example, an XML payload posts an order for three items. It uses a credit card to process the order.

The URL is: http://acmeonline.com/store

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

The following code snippet shows the doPost() method of the Servlet:

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)

...

}

After the posted XML is unmarshalled to the PurchaseOrder data object, the getOrderType() method should be used to identify the type of the order.

To Configure the Custom Match Rule

1. Navigate to the custom rule section for Servlet Entry Points.
2. In the Transaction Match Criteria tab, specify the URI.
3. In the Split Transactions Using Payload tab, check Split transactions using XML/JSON Payload or a Java method invocation.
4. Select Java XML Binding as the split mechanism.
5. Enter the class name and the method name.

The screenshot below shows a custom match rule which identifies the business transaction for this example as "Store.order.creditcard":

This custom rule ensures that the method in XMLBeans (which unmarshals XML to Java objects) is automatically intercepted. It also ensures that the getOrderType() method is applied on the Java data object only if it is the PurchaseOrder data object.

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() to get the name.

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

Supported Java XML data binding frameworks

The following Java XML data binding frameworks are supported:

  • Castor
  • JAXB
  • JibX
  • XMLBeans
  • XStream

Learn More