Handling a SOAP Fault
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2014
11:35 PM
12-18-2014
11:35 PM
Handling a SOAP Fault
Hi folks, before i start i would like to apologize for my bad English :-).
Now to the topic: is there a possibility in a SoapUI TestRunListener to recognize whether the TestStepResult in the afterStep method contains any SOAP Fault? I've considered to use the NotSoapFaultAssertion adding it to my TestStep before it is executed. But if i do so, the runner just quits after the Assertion fails. I would like to do something like this:
public void afterStep(TestCaseRunner runner, TestCaseRunContext context, TestStepResult stepResult) {
//pseudo code
if(stepResult.containsSoapFalt()){
//do something special, for example
runner.gotoStep(32);
} else {
runner.gotoStep(18);
}
}
I would like to have a chance to handle any SOAP fault AND to let my runner continue however.
Thanks for Help.
Now to the topic: is there a possibility in a SoapUI TestRunListener to recognize whether the TestStepResult in the afterStep method contains any SOAP Fault? I've considered to use the NotSoapFaultAssertion adding it to my TestStep before it is executed. But if i do so, the runner just quits after the Assertion fails. I would like to do something like this:
public void afterStep(TestCaseRunner runner, TestCaseRunContext context, TestStepResult stepResult) {
//pseudo code
if(stepResult.containsSoapFalt()){
//do something special, for example
runner.gotoStep(32);
} else {
runner.gotoStep(18);
}
}
I would like to have a chance to handle any SOAP fault AND to let my runner continue however.
Thanks for Help.
2 REPLIES 2
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2014
02:11 AM
12-23-2014
02:11 AM
You may check for below condition
By the way, check if you might be interested in this library
https://github.com/nmrao/soapuiExtensions
Regards,
Rao.
if ( (context.httpResponse.responseContent.contains(':Fault')) || (context.httpResponse.responseContent.contains('<Fault')) ) {
//Your stuff goes here
}
By the way, check if you might be interested in this library
https://github.com/nmrao/soapuiExtensions
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-25-2014
06:03 AM
12-25-2014
06:03 AM
Also there is another way:
Regards,
Rao.
import com.eviware.soapui.impl.wsdl.support.soap.SoapUtils
import com.eviware.soapui.impl.wsdl.support.soap.SoapVersion
import static com.eviware.soapui.impl.wsdl.support.soap.SoapUtils.isSoapFault
public void afterStep(TestCaseRunner runner, TestCaseRunContext context, TestStepResult stepResult) {
def content = context.httpResponse.responseContent
def soapVersion = SoapVersion.Soap11 //if 1.1, otherwise SoapVersion.Soap12
if (isSoapFault(content,soapVersion)) {
//your stuff goes here if response contains soap fault
} else {
//alternative stuff goes here
}
}
Regards,
Rao.
