You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by cheff <st...@gmail.com> on 2006/07/20 13:45:33 UTC

Re: Issue in the way servicemix handle soap errors

Hi

I saw your messages and the JIRA SM-433 but ... the fix does not work for
me.
For me, the web service exceptions should be handled from a SOAP Fault
Handler. For me the only correct response of a SOAP Request is a SOAP
Response (with Fault or not). If I need HTTP Error Message I should
implement my service not to return Exception.

For me the snippet:
...
        if (exchange.getStatus() == ExchangeStatus.ERROR) {
            if (exchange.getError() != null) {
                throw new Exception(exchange.getError());
            } else {
                throw new Exception("Unknown Error");
            }
        } else if (exchange.getStatus() == ExchangeStatus.ACTIVE) {
            try {
                if (exchange.getFault() != null) {
                    SoapFault fault = new SoapFault(SoapFault.RECEIVER,
null, null, null, exchange.getFault().getContent());
                    //sendFault(fault, request, response);
                	sendFault(exchange,fault,request,response);
                } else {
                    NormalizedMessage outMsg = exchange.getMessage("out");
                    if (outMsg != null) {
                        Context context = (Context)
request.getAttribute(Context.class.getName());
                        SoapMessage out = soapHelper.onReply(context,
outMsg);
                        SoapWriter writer = soapMarshaler.createWriter(out);
                        response.setContentType(writer.getContentType());
                        writer.write(response.getOutputStream());
                    }
                }
            } finally {
                exchange.setStatus(ExchangeStatus.DONE);
                channel.send(exchange);
            }
...

in ConsumerProcessor should be replaced with something like:
...
if (endpoing.isSoap())
    new SoapFault();
else
   ...

What you mean?
-- 
View this message in context: http://www.nabble.com/Issue-in-the-way-servicemix-handle-soap-errors-tf1559434.html#a5413095
Sent from the ServiceMix - User forum at Nabble.com.