Comments (5)
Hi @ismailastighfar, thanks for raising this.
A good fit here is the allOf
(or anyOf
) block. For example:
resources:
- operation: RetrievePatientInfoWithVIPIndicatorRequest
requestBody:
allOf:
- xPath: "/env:Envelope/env:Body/urn:RetrievePatientInfoWithVIPIndicatorRequest/sInstitutionCode"
value: "SGH"
- xPath: "/env:Envelope/env:Body/urn:RetrievePatientInfoWithVIPIndicatorRequest/sUserID"
value: "GSRVWCMSTG"
- xPath: "/env:Envelope/env:Body/urn:RetrievePatientInfoWithVIPIndicatorRequest/sPatNRIC"
value: "S2192071A"
- xPath: "/env:Envelope/env:Body/urn:RetrievePatientInfoWithVIPIndicatorRequest/sCallerSysADID:"
value: "WCMS"
xmlNamespaces:
env: "http://schemas.xmlsoap.org/soap/envelope/"
urn: "urn:sap-com:document:sap:rfc:functions"
response:
staticFile: ./oas/S2192071A.xml
More info here: https://docs.imposter.sh/request_matching/#using-multiple-request-body-matchers
from imposter.
Firstly, I would like to thank you for the response to my previous issue. I appreciate the support and guidance provided.
Despite following the suggested configuration, I am still encountering an error when trying to match multiple values in the SOAP request body using XPath. Below are the detailed error log.
08:47:31 DEBUG i.g.i.p.s.SoapResourceMatcher - Matched 0 operations in binding OASWebServiceBinding based on body root element: urn:RetrievePatientInfoWithVIPIndicatorRequest
08:47:31 WARN i.g.i.p.s.SoapResourceMatcher - No operations found matching body root element: urn:RetrievePatientInfoWithVIPIndicatorRequest
08:47:31 WARN i.g.i.u.BodyQueryUtil - Error evaluating XPath expression '/env:Envelope/soapenv:Body/urn:RetrievePatientInfoWithVIPIndicatorRequest/sInstitutionCode' against request body for [19ebc49a-42dd-41eb-aceb-2f6dddb9e8cd] POST http://localhost:8082/WCMS_OAS
java.lang.IllegalArgumentException: Namespace with prefix 'env' has not been declared.
at org.jdom2.xpath.util.AbstractXPathCompiled.getNamespace(AbstractXPathCompiled.java:256) ~[jdom2-2.0.6.1.jar:?]
at org.jdom2.xpath.jaxen.JaxenCompiled.translateNamespacePrefixToUri(JaxenCompiled.java:171) ~[jdom2-2.0.6.1.jar:?]
at org.jaxen.ContextSupport.translateNamespacePrefixToUri(ContextSupport.java:188) ~[jaxen-2.0.0.jar:?]
at org.jaxen.expr.DefaultNameStep.matches(DefaultNameStep.java:351) ~[jaxen-2.0.0.jar:?]
at org.jaxen.expr.DefaultNameStep.evaluate(DefaultNameStep.java:204) ~[jaxen-2.0.0.jar:?]
at org.jaxen.expr.DefaultLocationPath.evaluate(DefaultLocationPath.java:140) ~[jaxen-2.0.0.jar:?]
at org.jaxen.expr.DefaultAbsoluteLocationPath.evaluate(DefaultAbsoluteLocationPath.java:107) ~[jaxen-2.0.0.jar:?]
at org.jaxen.expr.DefaultXPathExpr.asList(DefaultXPathExpr.java:96) ~[jaxen-2.0.0.jar:?]
at org.jaxen.BaseXPath.selectNodesForContext(BaseXPath.java:662) ~[jaxen-2.0.0.jar:?]
at org.jaxen.BaseXPath.selectNodes(BaseXPath.java:215) ~[jaxen-2.0.0.jar:?]
at org.jaxen.BaseXPath.selectSingleNode(BaseXPath.java:236) ~[jaxen-2.0.0.jar:?]
at org.jdom2.xpath.jaxen.JaxenCompiled.evaluateRawFirst(JaxenCompiled.java:208) ~[jdom2-2.0.6.1.jar:?]
at org.jdom2.xpath.util.AbstractXPathCompiled.evaluateFirst(AbstractXPathCompiled.java:364) ~[jdom2-2.0.6.1.jar:?]
at io.gatehill.imposter.util.BodyQueryUtil.getXPathValue(BodyQueryUtil.kt:164) ~[imposter-engine-3.40.0.jar:?]
at io.gatehill.imposter.util.BodyQueryUtil.queryRequestBodyXPath(BodyQueryUtil.kt:154) ~[imposter-engine-3.40.0.jar:?]
at io.gatehill.imposter.http.AbstractResourceMatcher.matchRequestBodyXPath(AbstractResourceMatcher.kt:265) ~[imposter-engine-3.40.0.jar:?]
at io.gatehill.imposter.http.AbstractResourceMatcher.matchUsingBodyConfig(AbstractResourceMatcher.kt:235) ~[imposter-engine-3.40.0.jar:?]
at io.gatehill.imposter.http.AbstractResourceMatcher.matchRequestBody(AbstractResourceMatcher.kt:194) ~[imposter-engine-3.40.0.jar:?]
at io.gatehill.imposter.plugin.soap.SoapResourceMatcher.matchRequest(SoapResourceMatcher.kt:88) ~[imposter-mock-soap-3.40.0.jar:?]
at io.gatehill.imposter.http.AbstractResourceMatcher.filterResourceConfigs(AbstractResourceMatcher.kt:131) ~[imposter-engine-3.40.0.jar:?]
at io.gatehill.imposter.http.AbstractResourceMatcher.matchResourceConfig(AbstractResourceMatcher.kt:79) ~[imposter-engine-3.40.0.jar:?]
at io.gatehill.imposter.service.HandlerServiceImpl.handle(HandlerServiceImpl.kt:280) ~[imposter-engine-3.40.0.jar:?]
at io.gatehill.imposter.service.HandlerServiceImpl.access$handle(HandlerServiceImpl.kt:83) ~[imposter-engine-3.40.0.jar:?]
at io.gatehill.imposter.service.HandlerServiceImpl$build$2$1.invoke$lambda$2(HandlerServiceImpl.kt:119) ~[imposter-engine-3.40.0.jar:?]
at io.vertx.core.impl.ContextBase.lambda$executeBlocking$0(ContextBase.java:167) ~[vertx-core-4.4.5.jar:4.4.5]
at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:277) ~[vertx-core-4.4.5.jar:4.4.5]
at io.vertx.core.impl.ContextBase.lambda$internalExecuteBlocking$2(ContextBase.java:199) ~[vertx-core-4.4.5.jar:4.4.5]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[?:?]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.97.Final.jar:4.1.97.Final]
at java.lang.Thread.run(Unknown Source) ~[?:?]
08:47:31 DEBUG i.g.i.p.s.SoapResourceMatcher - Matched 0 operations in binding OASWebServiceBinding based on body root element: urn:RetrievePatientInfoWithVIPIndicatorRequest
08:47:31 WARN i.g.i.p.s.SoapResourceMatcher - No operations found matching body root element: urn:RetrievePatientInfoWithVIPIndicatorRequest
08:47:31 WARN i.g.i.p.s.SoapPluginImpl - Unable to find a matching binding operation using SOAPAction or SOAP request body
WSDL file :
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
targetNamespace="urn:sap-com:document:sap:rfc:functions">
<wsdl:message name="RetrievePatientInfoWithVIPIndicatorRequest">
<wsdl:part name="sInstitutionCode" type="xsd:string"/>
<wsdl:part name="sUserID" type="xsd:string"/>
<wsdl:part name="sPatNRIC" type="xsd:string"/>
<wsdl:part name="sCallerSysADID" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="RetrievePatientInfoWithVIPIndicatorResponse">
<wsdl:part name="PatientNRIC" type="xsd:string"/>
<wsdl:part name="PatientNRICType" type="xsd:string"/>
<wsdl:part name="PatientName" type="xsd:string"/>
<wsdl:part name="PatientBirthDate" type="xsd:string"/>
<wsdl:part name="VIPVVIPIndicator" type="xsd:string"/>
<wsdl:part name="InstitutionSpecificAddress" type="xsd:string"/>
<wsdl:part name="StatusCode" type="xsd:string"/>
<wsdl:part name="StatusDescription" type="xsd:string"/>
</wsdl:message>
<wsdl:portType name="OASWebServicePortType">
<wsdl:operation name="RetrievePatientInfoWithVIPIndicatorRequest">
<wsdl:input message="tns:RetrievePatientInfoWithVIPIndicatorRequest"/>
<wsdl:output message="tns:RetrievePatientInfoWithVIPIndicatorResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="OASWebServiceBinding" type="tns:OASWebServicePortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="RetrievePatientInfoWithVIPIndicatorRequest">
<soap:operation soapAction=""/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="OASWebService">
<wsdl:port name="OASWebServicePort" binding="tns:OASWebServiceBinding">
<soap:address location="http://localhost:8082/WCMS_OAS"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
SOAP Request
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:sap-com:document:sap:rfc:functions">
<soapenv:Header/>
<soapenv:Body>
<urn:RetrievePatientInfoWithVIPIndicatorRequest>
<urn:sInstitutionCode>SGH</urn:sInstitutionCode>
<urn:sUserID>GSRVWCMSTG</urn:sUserID>
<urn:sPatNRIC>S2192071A</urn:sPatNRIC>
<urn:sCallerSysADID>WCMS</urn:sCallerSysADID>
</urn:RetrievePatientInfoWithVIPIndicatorRequest>
</soapenv:Body>
</soapenv:Envelope>
Could you please help me identify what might be going wrong in my configuration or suggest any modifications to resolve this namespace declaration error?
Thank you for your continued support.
from imposter.
Related Issues (20)
- [Question] How can I serve WSDL file with SOAP plugin ? HOT 2
- NPE while parsing a WSDL with rpc/encoded style HOT 2
- Precompiling js script files fails from docker container HOT 6
- SOAP : WSDL with includes fails parsing HOT 1
- Autoreload when using docker and config files change HOT 2
- Support for RPC style SOAP services HOT 2
- Support XML attributes in SOAP request body XPath
- Unable to format data from store as JSON in javascript script handler HOT 11
- SQS plugin
- Scheduled steps
- SOAP: WSDL with targetNamespace and messages without namespace prefix parsing issue
- Plugin index file
- imposter-3.22.0.jar - REST request with content-type=multipart/form-data - how to access the parts ? Groovy script returns null body HOT 1
- "Docker Official Image" on docker hub
- [QUESTION] Configuration example for providing security config for individual plugins and swagger UI HOT 2
- Trivy reports lots of vulnerabilities HOT 2
- Possibility to configure list params
- Nashorn Load no longer working with Graal HOT 2
- Enforce client version through User-Agent header HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imposter.