imposter
imposter copied to clipboard
SOAP - auto generate fault responses
Question
Is it possible to auto generate soap FAULT responses with imposter?
Problem
When importing .wsdl & .xsd files and sending requests to the created endpoint, imposter automatically generates example responses.
For example this output, where it creates some random timestamp and uses one of a couple of defined statuses from within the used .xsd file:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header/>
<env:Body>
<del:StatusResponse xmlns:del="exampleNameSpace">
<del:status>IDLE</del:status>
<del:successTime>2007-04-20T23:21:24+02:00</del:successTime>
</del:StatusResponse >
</env:Body>
</env:Envelope>
But I can't seem to find anything similar to that, regarding soap faults. I can set the response status to 500, then it sends the request with that code, but the response is still the auto generated normal response.
A response like this for example:
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Body>
<env:Fault>
<faultcode xmlns="">env:Server</faultcode>
<faultstring xmlns="">This is a fault</faultstring>
<faultactor xmlns="" />
<detail xmlns="">
<hasn:ServiceException xmlns:hasn="exampleNameSpaceFault">
<hasn:errorCode>400-505</hasn:errorCode>
<hasn:message>Not working currently</hasn:message>
</hasn:ServiceException >
</detail>
</env:Fault>
</env:Body>
</env:Envelope>
And just to be sure that we are talkin about the same thing: In the operation part of a soap message, where we define the input and output, we can also define a fault, like this one here:
<wsdl:operation name="list">
<soap:operation soapAction="" style="document" />
<wsdl:input name="exampleInput">
<soap:body use="literal" />
</wsdl:input>
<wsdl:output name="exampleOutput">
<soap:body use="literal" />
</wsdl:output>
**<wsdl:fault name="exampleException">
<soap:fault name="exampleException" use="literal" />
</wsdl:fault>**
</wsdl:operation>
Resolve (?)
I'm not sure how much effort that is, but having something like "soapFault: true", which can be set in the config yaml, and it auto generates a fault response, would be really great. Or is this functionality already present, but I didn't find it?
Hi @Servanto, thanks for raising this. Here's a PR covering this functionality: #650