baruA
12 years agoOccasional Contributor
Extract Values from Soap XML response
I am comparing results from soap Response with JDBC response and added an Xpath expression but its keeping getting failed. Could anybody help me please and Thanks in advance.
Soap Response:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<InsertXXXXValueResponse xmlns="namespace">
<InsertXXXXValueResult><?xml version="1.0" encoding="utf-16"?>
<XXXXValues>
<XXXXValue Uid="2130" ValueCost="10" ValueDescription="ws test22" DailyUses="1" WebAvailableStartDate="9/3/2013" WebAvailableEndDate="9/15/2013" WebSalesLimit="2" WebSalesCount="0" WebTransactionLimit="2" WebSalesPriority="-2147483648" IgnoreWebSalesPriority="Yes" ReportTemplate="XXXX.rpt" />
</XXXXValues></InsertXXXXValueResult>
</InsertXXXXValueResponse>
</soap:Body>
</soap:Envelope>
JDBC Response:
<Results>
<ResultSet fetchSize="10">
<Row rowNumber="1">
<XXXX_VALUE_UID>2130</XXXX_VALUE_UID>
<EVA_XXXX_VALUE_COST>10</EVA_XXXX_VALUE_COST>
<EVA_XXXX_VALUE_DESCR>ws test22</EVA_XXXX_VALUE_DESCR>
<EVA_DAILY_USES>1</EVA_DAILY_USES>
<EVA_AVAIL_STARTDATE>2013-09-03 00:00:00.0</EVA_AVAIL_STARTDATE>
<EVA_AVAIL_ENDDATE>2013-09-15 23:59:59.0</EVA_AVAIL_ENDDATE>
<EVA_WEB_SALES_LIMIT>2</EVA_WEB_SALES_LIMIT>
<EVA_WEB_TRANSACTION_LIMIT>2</EVA_WEB_TRANSACTION_LIMIT>
<CRT_UID_PERMIT_REPORT>2702</CRT_UID_PERMIT_REPORT>
<CRT_TEMPLATE_NAME>XXXX.rpt</CRT_TEMPLATE_NAME>
</Row>
</ResultSet>
</Results>
Xpath Expression: declare namespace ns1='XXXX/';
//ns1:InsertxxxValueResponse[1]
declare namespace ns1='namespace/';
<InsertxxxValueResult><?xml version="1.0" encoding="utf-16"?>
//ns1:${JDBC Request#ResponseAsXml#//Results[1]/ResultSet[1]/Row[1]}
I am getting the below error on testing the assertion:
XPathContains comparison failed, expecting [declare namespace ns1=namespace/'; <?xml version="1.0" encoding="utf-16"?> //ns1: 2130 10 ws test22 1 2013-09-03 00:00:00.0 2013-09-15 23:59:59.0 2 2 2702 xxx.rpt ], actual was [ ]
Soap Response:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<InsertXXXXValueResponse xmlns="namespace">
<InsertXXXXValueResult><?xml version="1.0" encoding="utf-16"?>
<XXXXValues>
<XXXXValue Uid="2130" ValueCost="10" ValueDescription="ws test22" DailyUses="1" WebAvailableStartDate="9/3/2013" WebAvailableEndDate="9/15/2013" WebSalesLimit="2" WebSalesCount="0" WebTransactionLimit="2" WebSalesPriority="-2147483648" IgnoreWebSalesPriority="Yes" ReportTemplate="XXXX.rpt" />
</XXXXValues></InsertXXXXValueResult>
</InsertXXXXValueResponse>
</soap:Body>
</soap:Envelope>
JDBC Response:
<Results>
<ResultSet fetchSize="10">
<Row rowNumber="1">
<XXXX_VALUE_UID>2130</XXXX_VALUE_UID>
<EVA_XXXX_VALUE_COST>10</EVA_XXXX_VALUE_COST>
<EVA_XXXX_VALUE_DESCR>ws test22</EVA_XXXX_VALUE_DESCR>
<EVA_DAILY_USES>1</EVA_DAILY_USES>
<EVA_AVAIL_STARTDATE>2013-09-03 00:00:00.0</EVA_AVAIL_STARTDATE>
<EVA_AVAIL_ENDDATE>2013-09-15 23:59:59.0</EVA_AVAIL_ENDDATE>
<EVA_WEB_SALES_LIMIT>2</EVA_WEB_SALES_LIMIT>
<EVA_WEB_TRANSACTION_LIMIT>2</EVA_WEB_TRANSACTION_LIMIT>
<CRT_UID_PERMIT_REPORT>2702</CRT_UID_PERMIT_REPORT>
<CRT_TEMPLATE_NAME>XXXX.rpt</CRT_TEMPLATE_NAME>
</Row>
</ResultSet>
</Results>
Xpath Expression: declare namespace ns1='XXXX/';
//ns1:InsertxxxValueResponse[1]
declare namespace ns1='namespace/';
<InsertxxxValueResult><?xml version="1.0" encoding="utf-16"?>
//ns1:${JDBC Request#ResponseAsXml#//Results[1]/ResultSet[1]/Row[1]}
I am getting the below error on testing the assertion:
XPathContains comparison failed, expecting [declare namespace ns1=namespace/'; <?xml version="1.0" encoding="utf-16"?> //ns1: 2130 10 ws test22 1 2013-09-03 00:00:00.0 2013-09-15 23:59:59.0 2 2 2702 xxx.rpt ], actual was [ ]