Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(soap): adds support for returning SOAP faults #650

Merged
merged 5 commits into from
Oct 19, 2024

Conversation

outofcoffee
Copy link
Owner

@outofcoffee outofcoffee commented Oct 17, 2024

fixes #618

Returning fault messages

If your WSDL document defines a fault, then Imposter can generate a sample response from its type.

To return a fault you can:

  1. set the response status code to 500, or
  2. set the response.soapFault configuration property to true, or
  3. use the respond().withSoapFault() script function

Example configuration to respond with a fault

plugin: soap
wsdlFile: service.wsdl

resources:
  - binding: SoapBinding
    operation: getPetById
    response:
      statusCode: 500

Tip
Use conditional matching with resources, to only return a fault in particular circumstances.

Scripted example

Setting the status code to 500 will trigger a fault message to be returned if one is defined within the WSDL document.

respond().withStatusCode(500)

or:

respond().withSoapFault()

@outofcoffee outofcoffee marked this pull request as ready for review October 17, 2024 20:52
@outofcoffee outofcoffee changed the title feat(soap): adds support for returning SOAP faults when status code is 500 feat(soap): adds support for returning SOAP faults Oct 19, 2024
@outofcoffee outofcoffee changed the base branch from main to develop October 19, 2024 19:12
@outofcoffee outofcoffee merged commit cb9b05c into develop Oct 19, 2024
12 of 13 checks passed
@outofcoffee outofcoffee deleted the feat/soap-fault-example branch October 19, 2024 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SOAP - auto generate fault responses
1 participant