imposter
imposter copied to clipboard
[BUG] [SOAP plugin] java.lang.NullPointerException: null
Pre conditions
- WSDL is correct and works fine with other tools (e.g. Soap UI), mock server can be created with Soap UI
- WSDL and XSD are within same file, without imports to external file
Configuration
docker-compose.yaml
version: '3'
services:
imposter:
image: outofcoffee/imposter-all
ports:
- 8443:8443
volumes:
- $PWD:/opt/imposter/config
XXX-config.yaml
plugin: soap
wsdlFile: XXX.wsdl
Error
mockserver-imposter-1 | 13:34:10 INFO i.g.i.Imposter - Starting mock engine 3.0.0
mockserver-imposter-1 | 13:34:10 DEBUG i.g.i.c.u.ConfigUtil - Loading configuration file: /opt/imposter/config/XXX-config.yaml
mockserver-imposter-1 | 13:34:11 DEBUG i.g.i.p.PluginManager - Loaded 8 plugin(s): [js-detector, store-detector, meta-detector, js-nashorn-standalone, store-inmem, config-detector, store-graphql, soap]
mockserver-imposter-1 | 13:34:11 DEBUG i.g.i.p.s.p.VersionAwareWsdlParser - Using WSDL parser: V1 for: /opt/imposter/config/XXX.wsdl
mockserver-imposter-1 | 13:34:12 DEBUG i.g.i.p.s.p.Wsdl1Parser - Resolved element name tns:Close to qualified type: null
mockserver-imposter-1 | 13:34:12 ERROR i.v.c.i.l.c.VertxIsolatedDeployer - Failed in deploying verticle
mockserver-imposter-1 | java.lang.NullPointerException: null
mockserver-imposter-1 | at io.gatehill.imposter.plugin.soap.parser.Wsdl1Parser.getOperation(Wsdl1Parser.kt:159) ~[imposter-mock-soap-3.0.0.jar:?]
mockserver-imposter-1 | at io.gatehill.imposter.plugin.soap.parser.Wsdl1Parser.getBinding(Wsdl1Parser.kt:89) ~[imposter-mock-soap-3.0.0.jar:?]
mockserver-imposter-1 | at io.gatehill.imposter.plugin.soap.parser.VersionAwareWsdlParser.getBinding(VersionAwareWsdlParser.kt:91) ~[imposter-mock-soap-3.0.0.jar:?]
mockserver-imposter-1 | at io.gatehill.imposter.plugin.soap.SoapPluginImpl.parseWsdls(SoapPluginImpl.kt:122) ~[imposter-mock-soap-3.0.0.jar:?]
mockserver-imposter-1 | at io.gatehill.imposter.plugin.soap.SoapPluginImpl.configureRoutes(SoapPluginImpl.kt:106) ~[imposter-mock-soap-3.0.0.jar:?]
mockserver-imposter-1 | at io.gatehill.imposter.Imposter.configureRoutes(Imposter.kt:205) ~[imposter-engine-3.0.0.jar:?]
mockserver-imposter-1 | at io.gatehill.imposter.Imposter.access$configureRoutes(Imposter.kt:85) ~[imposter-engine-3.0.0.jar:?]
mockserver-imposter-1 | at io.gatehill.imposter.Imposter$start$1.invokeSuspend(Imposter.kt:128) ~[imposter-engine-3.0.0.jar:?]
mockserver-imposter-1 | at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) ~[kotlin-stdlib-1.6.21.jar:1.6.21-release-334(1.6.21)]
mockserver-imposter-1 | at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) ~[kotlinx-coroutines-core-jvm-1.6.2.jar:?]
mockserver-imposter-1 | at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570) ~[kotlinx-coroutines-core-jvm-1.6.2.jar:?]
mockserver-imposter-1 | at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:749) ~[kotlinx-coroutines-core-jvm-1.6.2.jar:?]
mockserver-imposter-1 | at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677) ~[kotlinx-coroutines-core-jvm-1.6.2.jar:?]
mockserver-imposter-1 | at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664) ~[kotlinx-coroutines-core-jvm-1.6.2.jar:?]
mockserver-imposter-1 exited with code 0
Hi @s33kers - thank you for reporting this.
The WSDL parser supports embedded schemas, as well as those referenced in external XSDs, so there appears to be a resolution problem here when looking up the element for the input message.
To help diagnose and fix this, please could you provide a sample WSDL file that exhibits this bug?
In addition, setting the following environment variable in your Docker Compose file will help provide more detailed logs:
IMPOSTER_LOG_LEVEL=TRACE
For example:
version: '3'
services:
imposter:
image: outofcoffee/imposter-all
ports:
- 8443:8443
volumes:
- $PWD:/opt/imposter/config
environment:
- IMPOSTER_LOG_LEVEL=TRACE
Hi,
I ran Wsdl1ParserTest with my WSDL and found these problems (tried to modify WSDL without changing code to indetify problems)
-
AbstractWsdlParser:76
supports extracting only 1 schema within WSDL. Workaround - extracted all schemas to separate.xsd
-
Wsdl1Parser:165
style attribute is taken fromoperation
, however it can be provided asbinding
as a default for all operations. Workaround - add style attribute to<soap:operation style="document" ...
(e.g. https://schemas.xmlsoap.org/wsdl/soap12/soap12wsdl.htm see<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
) -
Wsdl1Parser:191
should use message attribute instead of name + remove schema prefix
Hope it helps someone too:)
Support for multiple schemas in a WSDL file added in 44950332.
Operation style fallback to binding style added in 765f1792.
Use of message
attribute to locate message element added in 39a9de05.
Released in v3.3.0. Thanks again @s33kers.