citrusframework / citrusframework/citrus

propagateError for SOAP send() action with 400 Bad request http response header

Open
#709 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
485
Forks
155
Avg merge
4d 22h
Merged PRs (30d)
6

Description

**Citrus Version**

I am using Eclipse Java EE IDE for Web Developers. Version: 2018-09 (4.9.0) for my Citrus testing

**Question**

Currently I am trying to send a SOAP action through Soap11 Endpoint and I am expected to receive a 400 Bad request http header, however it is throwing exception during the send action and we won't able to receive and validate it further.

SOAP action I am trying to do
```
//Service Operation
soap(builder -> builder.client("somethingSoap11Endpoint").send()
.payload(new ClassPathResource("smaplePayloadToTriggerBadRequestResponse.xml")).soapAction("smapleAction"));
```
somethingSoap11Endpoint configuration we are using:
```
public WebServiceClient somethingSoap11Endpoint()
throws KeyManagementException, NoSuchAlgorithmException, KeyStoreException {
return CitrusEndpoints.soap()
.client()
.defaultUri(sampleURI)
.interceptors(clientInterceptors())
.messageSender(sslRequestMessageSender())
.faultStrategy(ErrorHandlingStrategy.PROPAGATE)
.build();
}
```
**What I've tried so far**

my team was working with SOAP11 and SOAP12 Endpoint both, so we did find solution for **SOAP12 Endpoint** which is adding **_.faultStrategy(ErrorHandlingStrategy.PROPAGATE_** to the Endpoint configuration which is working and can actually receive the response instead of raising the exception, however it is not working for SOAP11 Endpoint.

So currently we have to use a ugly workaround like putting this in a try catch block and manually check the response header, but this will lose all the details from the response.

```
try {
soap(builder -> builder.client("somethingSoap11Endpoint").send()
.payload(new ClassPathResource("smaplePayloadToTriggerBadRequestResponse.xml")).soapAction("smapleAction"));
}catch (Exception e) {
//log.error(e.getLocalizedMessage());
if(!e.getLocalizedMessage().equalsIgnoreCase("Bad Request [400]"))
fail("Wrong response: Test case expected a response of \"Bad Request [400]\"")
}

```
**Additional information**

https://github.com/citrusframework/citrus/issues/236
I did find this to help me understand what is the cause of the issue, but not sure if there is a fix now after this time being.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.