zoomit
13 years agoNew Contributor
Using XQuery Asserstion
Hi
When I have used below XQuery to get details in "Table" for following SOAP Response, I got error message as "Invalid XQuery expression". Could anyone help me to know what is the issue in XQuery?
SOAP Response:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetInfoByZIPResponse xmlns="http://www.webserviceX.NET">
<GetInfoByZIPResult>
<NewDataSet xmlns="">
<Table>
<CITY>Albert</CITY>
<STATE>OK</STATE>
<ZIP>73001</ZIP>
<AREA_CODE>405</AREA_CODE>
<TIME_ZONE>C</TIME_ZONE>
</Table>
</NewDataSet>
</GetInfoByZIPResult>
</GetInfoByZIPResponse>
</soap:Body>
</soap:Envelope>
XQuery
declare namespace ns1='';
declare namespace ns2='http://www.webserviceX.NET';
<Result>
{
for $a in //ns2:GetInfoByZIPResponse/ns2:GetInfoByZIPResult/ns1:NewDataSet/ns1:Table
return $a
}
</Result>
When I have used below XQuery to get details in "Table" for following SOAP Response, I got error message as "Invalid XQuery expression". Could anyone help me to know what is the issue in XQuery?
SOAP Response:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetInfoByZIPResponse xmlns="http://www.webserviceX.NET">
<GetInfoByZIPResult>
<NewDataSet xmlns="">
<Table>
<CITY>Albert</CITY>
<STATE>OK</STATE>
<ZIP>73001</ZIP>
<AREA_CODE>405</AREA_CODE>
<TIME_ZONE>C</TIME_ZONE>
</Table>
</NewDataSet>
</GetInfoByZIPResult>
</GetInfoByZIPResponse>
</soap:Body>
</soap:Envelope>
XQuery
declare namespace ns1='';
declare namespace ns2='http://www.webserviceX.NET';
<Result>
{
for $a in //ns2:GetInfoByZIPResponse/ns2:GetInfoByZIPResult/ns1:NewDataSet/ns1:Table
return $a
}
</Result>