[working]Issue in accessing the elements of input XML using XPATH 2.0 while setting up aspects in TIBCO BusinessWorks ProcessMonitor.

[working]Issue in accessing the elements of input XML using XPATH 2.0 while setting up aspects in TIBCO BusinessWorks ProcessMonitor.

book

Article ID: KB0090039

calendar_today

Updated On:

Products Versions
TIBCO BusinessWorks ProcessMonitor -
Not Applicable -

Description

Description:

When attempting to setup aspect configurations in TIBCO BusinessWorks ProcessMonitor (BWPM) and trying to access an XML as the input element using XPATH2.0, we do not get the expected value as the result. The result does not provide any value, i.e., the XPATH expression yields blank.


Symptoms:

This issue can be explained as follows.

1). Consider that the input XML is the file below:

<ns0:GetNumberOfDaysRes>
<ResponseHeader>

        <ns1:SentRequestID xmlns:ns1="http://www.repsrv.com/ResponseBaseType">2014042409302453-SRAZPHX171-5000-ePortalAssetWS-ePortalAssetWS-ProcessArchive-171</ns1:SentRequestID>
        <ns1:overallStatus xmlns:ns1="http://www.repsrv.com/ResponseBaseType">Error</ns1:overallStatus>
        <ns1:responseTimeStamp xmlns:ns1="http://www.repsrv.com/ResponseBaseType">2014-04-24T09:30:27.227-07:00</ns1:responseTimeStamp>
        <ns1:errorList xmlns:ns1="http://www.repsrv.com/ResponseBaseType">
            <ns2:errorItem xmlns:ns2="http://www.repsrv.com/ServiceBaseTypes">
                <ns2:errorCode>50005</ns2:errorCode>
                <ns2:errorLevel>Exception</ns2:errorLevel>
                <ns2:errorDescription>PK_Customer_ID 1171 not found in table Customer</ns2:errorDescription>
                <ns2:errorStackTrace>RepublicSystemServices/CDH/SystemInterfaces/Asset/GetNumberOfDays.process/CDH Result 0 Error</ns2:errorStackTrace>
            </ns2:errorItem>
        </ns1:errorList>
        <ns1:auditTrack xmlns:ns1="http://www.repsrv.com/ResponseBaseType">
            <ns2:auditAppName xmlns:ns2="http://www.repsrv.com/AuditTrackBaseType">ePortal</ns2:auditAppName>
            <ns2:auditDomain xmlns:ns2="http://www.repsrv.com/AuditTrackBaseType">ePortalAssetWS</ns2:auditDomain>
            <ns2:auditTransID xmlns:ns2="http://www.repsrv.com/AuditTrackBaseType">2014042409302453-SRAZPHX171-5000-ePortalAssetWS-ePortalAssetWS-ProcessArchive-171</ns2:auditTransID>
        </ns1:auditTrack>
    </ResponseHeader>
</ns0:GetNumberOfDaysRes>

2). The element trying to be reached (using XPATH 2.0) is 'ns2:errorStackTrace'.

3). Set the XPATH to '//ns2:errorStackTrace' and test expression.

4). The result does not result in any value, that is, the XPATH expression yields blank.
Cause:
Exact XPATH Expression was unable to retrieve the value when using a generic Expression with the required fieldname, it returns the expected result. For XPATH , the namespace must be a part of the XPATH expression. To accept any namespace prefix in the expression '//*:fieldname[1]', the XPATH processor searches for all 'fieldname' elements in all namespaces and returns the value of the first result.

Resolution

In order to get the desired result using XPATH 2.0 we can access the elements of input XML using //*: instead of the actual namespace prefix such as ns2 (as mentioned in step 3 of the Description). That is, instead of writing  '//ns2:errorStackTrace' in the expression to test, write '//*:errorStackTrace'.

The following will be the result of the expression: RepublicSystemServices/CDH/SystemInterfaces/Asset/GetNumberOfDays.process/CDH Result 0 Error


Issue/Introduction

[working]Issue in accessing the elements of input XML using XPATH 2.0 while setting up aspects in TIBCO BusinessWorks ProcessMonitor.