Q:

wrap a SOAP call (WebServiceGatewaySupport) with Hystrix

I am trying to find out an example to use hystrix with SOAP call and all i could find the examples of the same with REST.
From the hystrix documentation, it seems this is possible, if you could point me to the example that would be helpful.
Also, if there are any better ways of having a consistent circuit breaker between REST and SOAP calls (maybe extensible to EJB's).

A:

You can do this by creating an inner class which extends HystrixCommand and then override  the run() method.
public class webServiceClient extends WebServiceGatewaySupport {
public Response callsoap(Request request) {
    SoapCommand sfc = new SoapCommand(getWebServiceTemplate(), request, 
            soapRequestHeaderModifier, configuration);
    return  sfc.execute();
}

class SoapCommand extends HystrixCommand<Response>{
    public SoapCommand() {
        super(HystrixCommandGroupKey.Factory.asKey("example"));
    }
    @Override
    protected Response run() {
        return (Response) webServiceTemplate.marshalSendAndReceive(configuration.getUri(), 
                request, soapRequestHeaderModifier);
    }
    //fallback method goes here
}

}

