JAXWSMethodInvoker doesn't honour faultcode in thrown SoapFault
---------------------------------------------------------------

                 Key: CXF-1534
                 URL: https://issues.apache.org/jira/browse/CXF-1534
             Project: CXF
          Issue Type: Bug
          Components: JAX-WS Runtime
    Affects Versions: 2.0.5
            Reporter: Simon Matic Langford


I have written a service which implements an interface generated using 
wsdl2java.

In it I create and throw a SoapFault with a custom faultcode using code like 
this:

throw new SoapFault("An error message", new 
QName("http://www.company.com/blah","Server.InvalidConfiguration";));

But in JAXWSMethodInvoker:
    protected Fault createFault(Throwable ex, Method m, List<Object> params, 
boolean checked) {
        //map the JAX-WS faults
        if (ex instanceof SOAPFaultException) {
            SOAPFaultException sfe = (SOAPFaultException)ex;
            SoapFault fault = new SoapFault(sfe.getFault().getFaultString(),
                                            sfe,
                                            
sfe.getFault().getFaultCodeAsQName());
            fault.setRole(sfe.getFault().getFaultActor());
            fault.setDetail(sfe.getFault().getDetail());
            
            return fault;
        }
        return super.createFault(ex, m, params, checked);
    }

you're missing an extra if:
            if (ex instanceof Fault) {
                        return (Fault) ex;
            }

which means it drops through to super, which loses my fault code and only keeps 
the message.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to