Forum Discussion

MWahlberg's avatar
MWahlberg
Occasional Contributor
11 years ago

[R]"OriginalURI" in ResponseAsXml destroys XPath Match decla

Hello,

Ive notice a change in 5.0.0 regarding namespace URIs in ResponseAsXML, for ex when sending a REST request like

GET http://endpoint/api/platform/person-repository/v1/persons/85c43933-cc0f-4463-b0c5-966637180031


The ResponseAsXml will contain a "originalURI" in namespace which has a resourceid that is different from the actual URI request resourceid :
<Response xmlns="http://endpoint/api/platform/person-repository/v1/persons/ee8cfdee-c15a-4a49-a372-d2288b757f3e">


IN the project XML it is seen as <con:originalUri> on request level:
<con:restRequest name="getPersonByPersonId" mediaType="application/json">
<con:settings>
<con:setting id="com.eviware.soapui.impl.wsdl.WsdlRequest@request-headers">&lt;entry key="xxxxxxxxx-customerid" value="${#TestSuite#customerId}" xmlns="http://eviware.com/soapui/config"/></con:setting>
</con:settings>
<con:endpoint>${#Project#Endpoint}</con:endpoint>
<con:request/>
<con:originalUri>http://endpoint/api/platform/person-repository/v1/persons/ee8cfdee-c15a-4a49-a372-d2288b757f3e</con:originalUri>

Compare
v1/persons/85c43933-cc0f-4463-b0c5-966637180031 resource id used in GET request
v1/persons/ee8cfdee-c15a-4a49-a372-d2288b757f3e resource id (originalURI) now shown in ResponseAsXml


So When I try to use XPath assertions on the response, the declaration (namespace) will only work with using the the originalURI in the namespace declaration.
This behaviour was not noticed in 4.6.4, where I could paramterize the resourceids as for ex ${#TestCase#personId} as in

declare namespace ns1='${#Project#Namespace}/persons/${#TestCase#personId}';
//ns1:Response[1]/ns1:civicNo[1]/text()


now ill have to declare it using an "originalURI"
declare namespace ns1='${#Project#Namespace}/persons/ee8cfdee-c15a-4a49-a372-d2288b757f3e';
//ns1:Response[1]/ns1:civicNo[1]/text()


Is this intended behaviour?
This change forced me to revert ot 4.6.4 to keep old testcases running

/Lars

2 Replies

  • SiKing's avatar
    SiKing
    Community Expert
    ResponseAsXML is just made up XML - it's the actual JSON converted to something that looks like XML.
    If you use a wildcard (*) for the namespace, then it should work fine.
  • MWahlberg's avatar
    MWahlberg
    Occasional Contributor
    Thanks, informative answer. And the suggestion you provided is acceptable, and it works fine for my testcases.
    Thanks.