Giter Club home page Giter Club logo

Comments (2)

outofcoffee avatar outofcoffee commented on July 21, 2024

Hi @nicodax, thanks for your question. Right now, there isn't an endpoint that serves the WSDL file automatically but it would be a useful feature.

If you have an existing WSDL file that you'd like to serve from a given endpoint, you could add a resource to your configuration such as:

plugin: soap

resources:
- path: /wsdl
  method: get
  response:
    file: ./your-file.wsdl

This will serve the content of the WSDL file on the http://<mock-server-address>/wsdl endpoint.

from imposter.

nicodax avatar nicodax commented on July 21, 2024

Hi @outofcoffee, thanks for your response.

I tried your suggestion and had syntax troubles:

get_person_stub  | 13:16:26 INFO  i.g.i.Imposter - Starting mock engine 3.35.1
get_person_stub  | 13:16:26 DEBUG i.g.i.c.u.ConfigUtil - Loading configuration file: ConfigReference(file=/opt/imposter/config/imposter_soap-config.yaml, configRoot=/opt/imposter/config)
get_person_stub  | 13:16:27 DEBUG i.g.i.p.PluginManager - Loaded 9 plugin(s): [js-detector, store-detector, meta-detector, js-nashorn, store-inmem, config-detector, store-graphql, fake-data, soap]
get_person_stub  | 13:16:28 ERROR i.v.c.i.l.c.VertxIsolatedDeployer - Failed in deploying verticle
get_person_stub  | java.lang.RuntimeException: Error configuring plugin: soap
get_person_stub  | 	at io.gatehill.imposter.plugin.PluginManagerImpl.configurePlugins(PluginManagerImpl.kt:133) ~[imposter-config-3.35.1.jar:?]
get_person_stub  | 	at io.gatehill.imposter.plugin.PluginManagerImpl.startPlugins(PluginManagerImpl.kt:91) ~[imposter-config-3.35.1.jar:?]
get_person_stub  | 	at io.gatehill.imposter.Imposter$start$1.invokeSuspend(Imposter.kt:132) ~[imposter-engine-3.35.1.jar:?]
get_person_stub  | 	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) ~[kotlin-stdlib-1.9.10.jar:1.9.10-release-459]
get_person_stub  | 	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108) ~[kotlinx-coroutines-core-jvm-1.7.3.jar:?]
get_person_stub  | 	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584) ~[kotlinx-coroutines-core-jvm-1.7.3.jar:?]
get_person_stub  | 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793) ~[kotlinx-coroutines-core-jvm-1.7.3.jar:?]
get_person_stub  | 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697) ~[kotlinx-coroutines-core-jvm-1.7.3.jar:?]
get_person_stub  | 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684) ~[kotlinx-coroutines-core-jvm-1.7.3.jar:?]
get_person_stub  | Caused by: java.lang.RuntimeException: Error loading plugin config: LoadedConfig(ref=ConfigReference(file=/opt/imposter/config/imposter_soap-config.yaml, configRoot=/opt/imposter/config), serialised=plugin: soap
get_person_stub  | wsdlFile: person_service.wsdl
get_person_stub  | 
get_person_stub  | resources:
get_person_stub  |   - path: /wsdl
get_person_stub  |     method: get
get_person_stub  |     response:
get_person_stub  |       file: ./person_service.wsdl

... Rest of the configuration ...

get_person_stub  | 	at io.gatehill.imposter.plugin.config.ConfiguredPlugin.loadConfiguration(ConfiguredPlugin.kt:79) ~[imposter-engine-3.35.1.jar:?]
get_person_stub  | 	at io.gatehill.imposter.plugin.PluginManagerImpl.configurePlugins(PluginManagerImpl.kt:130) ~[imposter-config-3.35.1.jar:?]
get_person_stub  | 	... 8 more
get_person_stub  | Caused by: java.lang.RuntimeException: Error loading configuration file: /opt/imposter/config/imposter_soap-config.yaml, reason: Unrecognized field "method" (class io.gatehill.imposter.plugin.soap.config.SoapPluginResourceConfig), not marked as ignorable (9 known properties: "security", "response", "path", "capture", "operation", "eval", "soapAction", "binding", "requestBody"])
get_person_stub  |  at [Source: (StringReader); line: 6, column: 16] (through reference chain: io.gatehill.imposter.plugin.soap.config.SoapPluginConfig["resources"]->java.util.ArrayList[0]->io.gatehill.imposter.plugin.soap.config.SoapPluginResourceConfig["method"])
get_person_stub  | 	at io.gatehill.imposter.config.util.ConfigUtil.loadPluginConfig(ConfigUtil.kt:320) ~[imposter-config-3.35.1.jar:?]
get_person_stub  | 	at io.gatehill.imposter.plugin.config.ConfiguredPlugin.loadConfiguration(ConfiguredPlugin.kt:74) ~[imposter-engine-3.35.1.jar:?]
get_person_stub  | 	at io.gatehill.imposter.plugin.PluginManagerImpl.configurePlugins(PluginManagerImpl.kt:130) ~[imposter-config-3.35.1.jar:?]
get_person_stub  | 	... 8 more
get_person_stub exited with code 0

It seems the method field does not exist for the SOAP plugin. At least, I could not find mentions of it within the documentation.

What I did though was to create a second imposter YAML config file, using the REST plugin this time, and serving the wsdl file over a GET request:

plugin: rest
path: "/GetPersonService"
response:
  file: person_service.wsdl
  headers:
    Content-Type: "text/xml"

This works as expected and we are now able to access the WSDL file directly from the imposter instance.

Closing this issue as it is now resolved.

Thanks !

from imposter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.