search cancel

Xpath validation fails when namespace prefixes are not globally unique.

book

Article ID: 190666

calendar_today

Updated On:

Products

CA Cloud Test Mobile CA Application Test Service Virtualization

Issue/Introduction

Having problems with Devtest 10.5, in which an xpath string fails validation due to non-unique namespace prefixes.

This is the xpath string, and this is the xml body that fails validation (bolded below).  If you look, tns5 has been declared twice, and this is valid xml from what I understand, yet the devtest program fails to validate it.

Can you please assist with troubleshooting how to proceed ?



xpath:    /tns8:Envelope/tns8:Body/tns14:QueryResponse/tns5:resultSets/tns5:object/tns5:objectType = 'https://<<SERVER_NAME>>/esb/ontology/object/pdm/task#ActionItem'

XML data:

 

<tns8:Envelope xmlns:tns8="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.abc.com/namespaces/tnt/plugins/jms+6564d21d-47ea-4b91-bdd3-c1e6c4c5642d+output" xmlns:tns10="http://<<SERVER>>/schemas/MessageProcessor" xmlns:tns2="http://www.abc.com/namespaces/tnt/plugins/jms+55eb2861-5120-4fab-9044-8cc0576a8055+input" xmlns:tns5="http://www.abc.com/schemas/JMSApplicationProperties">

  <tns8:Body>

    <tns14:QueryResponse xmlns:tns14="http://<<SERVER>>/schemas/FederatedQuery/v1" xmlns:ns3="http://<<SERVER>>schemas/commonshared/public/query/FederatedQuery/v1" xmlns:tns12="http://<<SERVER>>/schemas/MessageProcessor">

      <tns5:resultSets xmlns:tns5="http://<<SERVER>>/schemas/FederatedQuery/v1" xmlns:ns1="http://<<SERVER>>/schemas/FedQryMapActivities/v1" xmlns:tib="http://www.tibco.com/bw/xslt/custom-functions" xmlns:tns="http://tns.tibco.com/bw/palette/internal/accumulateoutput+f3d5a155-0296-4eab-9d1e-5b0ee53d2fe7" xmlns:tns2="https://<<SERVER>>/esb/client/dataregistry/shared/Schemas/public/DataRegistryOperations" xmlns:tns6="http://<<SERVER>>/schemas/SharedVariables/v1" xmlns:tns7="http://<<SERVER>>/schemas/QueryExpansionProperties/v1">

        <tns5:object>

          <tns5:objectType>https://<<SERVER>>/esb/ontology/object/pdm/task#ActionItem</tns5:objectType>

          <tns5:sourceSystem>https://nasa-ice.nasa.gov/esb/ontology/system#Windchill</tns5:sourceSystem>

          <tns5:systemId>OR:wt.meeting.actionitem.DiscreteActionItem:568252:[email protected]<<SERVER>></tns5:systemId>

          <tns5:properties>

            <tns5:comment>FS-AI-001 Comments</tns5:comment>

            <tns5:createDate>2015-10-14 14:44:12 CDT</tns5:createDate>

            <tns5:creator>rbunner</tns5:creator>

            <tns5:description>employeenumber=321981541,ou=people,dc=<<ORG>>,dc=<<SERVER>>@<<SERVER_sub>></tns5:description>

            <tns5:detailsUrl>https://<<SERVER>>/Windchill/app/#ptc1/tcomp/infoPage?oid=OR:wt.meeting.actionitem.DiscreteActionItem:568252</tns5:detailsUrl>

            <tns5:modifier>******</tns5:modifier>

            <tns5:owner>********</tns5:owner>

            <tns5:parentContainer>QA Testing Product</tns5:parentContainer>

            <tns5:state>RESOLVED</tns5:state>

            <tns5:updateDate>2015-10-14 14:44:12 CDT</tns5:updateDate>

          </tns5:properties>

        </tns5:object>

      </tns5:resultSets>

    </tns14:QueryResponse>

  </tns8:Body>

</tns8:Envelope>

Environment

Release : 10.x

Component : CA Service Virtualization

Cause

In the example, XML overrides namespace prefixes in the same document, e.g.
      1. xmlns:tns5="http://www.abc.com/schemas/JMSApplicationProperties" and then later on xmlns:tns5="http://<<SERVER>>/schemas/FederatedQuery/v1".
      2. xmlns:tns2="http://www.abc.com/namespaces/tnt/plugins/jms+55eb2861-5120-4fab-9044-8cc0576a8055+input" and then later on xmlns:tns2="https://<<SERVER>>/esb/client/dataregistry/shared/Schemas/public/DataRegistryOperations"

While it is valid in XML, XPath uses as its context the entire XML document, so we require that a prefix uniquely maps to one namespace URI, i.e. we can't map one prefix to multiple namespace URIs in this context with the current/default parser we provide in DevTest for XML parsing. 

Resolution

 DevTest  has the support for the XimpleWare's VTD-XML which is, far and away, industry's most advanced and powerful XML parser. Parsing the sample XML with VTD-XML parser would fix the  issue. 


To use VTD-XML parser for XML processing, we need to follow below steps:

1. Add the below property in lisa.properties:

lisa.xpath.useVtd=true 

2. Download the attached vtd-xml_2.13_4.jar jar and place it in /lib/shared folder.

3. Restart all the DevTest component services (atleast Registry, Coordinator, Simualtor services).

Attachments

1661277724934__vtd-xml-2.13.4.jar get_app