How can I extract variables from a SOAP response without namespace using Extract Variable policy.
SOAP response:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Body> <ServiceCatalogResponse xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <ServiceReply xsi:type="ns:ServiceReply" xmlns:ns="http://xmlns.telco.com/ServiceCatalog/ServiceReply" xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/"> <ns:Header> <ns1:ResponseCode xmlns:ns1="http://xmlns.telco.com/EAI/Common/ResponseCodes">0</ns1:ResponseCode> <ns1:ResponseMsg xmlns:ns1="http://xmlns.telco.com/EAI/Common/ResponseCodes">Success</ns1:ResponseMsg> <ns1:ErrorDescription xmlns:ns1="http://xmlns.telco.com/EAI/Common/ResponseCodes"/> <ns1:RequestId xmlns:ns1="http://xmlns.telco.com/EAI/Common/ResponseCodes">41d17462666776</ns1:RequestId> </ns:Header>
Sample excerpt of Extract Variable policy:
<Variable type="string" name="ResponseCode"> <XPath>/SOAP-ENV:Envelope/SOAP-ENV:Body/xs:ServiceCatalogResponse/type:ServiceReply/ns:Header/ns1:ResponseCode/text()</XPath> </Variable>
My challenge is ServiceCatalogResponse and ServiceReply.How can I extract variable from the SOAP response and map it to the Extract Variable policy?
You shouldn't include an alias for elements with no namespaces.
In your example,
/SOAP-ENV:Envelope/SOAP-ENV:Body/ServiceCatalogResponse/ServiceReply/ns:Header/ns1:ResponseCode/text()
should work.
Tip: You can use online tools such as https://www.freeformatter.com/xpath-tester.html to test XPath expressions
User | Count |
---|---|
7 | |
2 | |
2 | |
1 | |
1 |