soapspring-ws

WS/SOAP - how to detect a failure in a response message?


We receive SOAP messages similar to the following code:

@Endpoint
public class SomeEndpoint {
    // ... 
    @PayloadRoot(namespace = NAMESPACE_URI, localPart = "getSomeRequest")
    @ResponsePayload
    public GetCountryResponse getCountry(@RequestPayload GetCountryRequest request) {
        GetCountryResponse response = new GetCountryResponse();
        response.setCountry(countryRepository.findCountry(request.getName()));
        return response;
    }
}

I guess this is a synchronous request. Sometimes the response message (here: GetCountryResponse) is not delivered to the sender of the original request. This could be due to network delays or other issues.

How can we detect errors during the sending of the response message? Can we influence the number of retries?

Of course I could build some kind of Interceptor or so. There must be a standard way to detect these errors.

We need this because when the response message is not correctly sent, we need to stop the service. No further requests are allowed.


Solution

  • The answer is simple. It is a synchronous call. It is the responsibility of the caller to do the error handling. If no answer is received, just resend the request.