Skip to end of metadata
Go to start of metadata

This topic describes how to identify transactions when an XML is posted to a Servlet.

Business Transactions and XML Payload

The XML contains the naming information for the Business Transaction. The Servlet uses a DOM parser to parse the posted XML into a DOM object.

Identifying the Business Transaction Using the XPath Expression

For example, the following XML posts an order for three items. The order uses credit card processing.


The URL is:

The doPost method of the Servlet is:

public void doPost(HttpServletRequest req, HttpServletResponse resp)

DocumentBuilderFactory docFactory =
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document doc = docBuilder.parse(req.getInputStream());

Element  element = doc.getDocumentElement();

//read the type of order
//read all the items

The XPath expression "//order/type" on this XML payload evaluates to "creditcard".

This value correctly identifies the type of the order and therefore  should be used to name the "Order" transaction.

To identify the Business Transactions in this manner, first configure a custom match rule that automatically intercepts the method that parses the XML and gets the DOM object.

You use the XPath expression in the custom rule so that it names the transaction, for example "". Though the name is not obtained until the XML is parsed, AppDynamics measures the duration of the business transaction to include the execution of the doPost() method.

To configure a custom match rule

1. Navigate to the custom rule section for Servlets.

2. In the Transaction Match Criteria tab, specify the URI.

3. In the Split Transactions Using Payloads tab, enable Split transactions using XML/JSON Payload or a Java method invocation.

4. Set the split mechanism to  XPath Expressions.

5. Enter the XPath expression that you want to set as the Entry Point. The result of the XPath expression will be appended to the name of the Business Transaction.



You can use one or more XPath expressions to chain the names generated for the Business Transaction.

If the expression does not evaluate to a value, the transaction will not be identified.

Learn More