cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wolfgang Winter (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-3442) Fault should not swallow the cause exception message
Date Thu, 12 Dec 2013 12:45:08 GMT

    [ https://issues.apache.org/jira/browse/CXF-3442?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13846280#comment-13846280
] 

Wolfgang Winter commented on CXF-3442:
--------------------------------------

This issue is in status Fixed for version 2.4, 2.3.4 but in cxf-api-2.7.3 it is not fixed.

What is the status of this issue? I have the same problem of seeing only 'Problems creating
SAAJ object model' but not the underlying real error.

> Fault should not swallow the cause exception message
> ----------------------------------------------------
>
>                 Key: CXF-3442
>                 URL: https://issues.apache.org/jira/browse/CXF-3442
>             Project: CXF
>          Issue Type: Improvement
>          Components: Soap Binding
>            Reporter: Willem Jiang
>            Assignee: Willem Jiang
>            Priority: Minor
>             Fix For: 2.4, 2.3.4
>
>
> When sending an invalid SOAP message specifically with an incorrect end tag:
> {code}
> snip...
>   <soapenv:Body>
>       <cus:lookupCustomer>
>          <customerId>1</customerId>
>          <customerId2>1</customerId2>
>       <cus:lookupCustomer>   <------- no slash.
>    </soapenv:Body>
> end snip..
> {code}
> The wrong SOAP fault is thrown when using the WSS4JInInterceptor:
> {code}
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>    <soap:Body>
>       <soap:Fault>
>          <faultcode>soap:Client</faultcode>
>          <faultstring>Problems creating SAAJ object model</faultstring>
>       </soap:Fault>
>    </soap:Body>
> </soap:Envelope>
> {code}
> When the WSS4JInInterceptor is removed the following exception is thrown:
> {code}
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>    <soap:Body>
>       <soap:Fault>
>          <faultcode>soap:Client</faultcode>
>          <faultstring>Unmarshalling Error: cvc-complex-type.2.4.d: Invalid content
was found starting with element 'cus:lookupCustomer'. No child element is expected at this
point.</faultstring>
>       </soap:Fault>
>    </soap:Body>
> </soap:Envelope>
> {code}
> If you enable the WSS4JInInterceptor, CXF will use SAAJInInterceptor to create a SOAP
message for using.
> That could explain that you got the "Problems creating SAAJ object model" message.
> I just checked the code of SAAJInInterceptor, it just wrap the real cause of exception
message like this
> {code}
> } catch (SOAPException soape) {
>             throw new SoapFault(new org.apache.cxf.common.i18n.Message(
>                     "SOAPHANDLERINTERCEPTOR_EXCEPTION", BUNDLE), soape,
>                     message.getVersion().getSender());
>         } catch (XMLStreamException e) {
>             throw new SoapFault(new org.apache.cxf.common.i18n.Message(
>                     "SOAPHANDLERINTERCEPTOR_EXCEPTION", BUNDLE), e, message
>                     .getVersion().getSender());
>         }
> {code}
> After digging the code more, I found the SoapFault and it's parent Fault doesn't take
the cause exception into consideration.
> When the Fault reason send to the client, it just a Fault message without the cause.
It's difficult for the user to trace the real cause of the exception. My suggestion is change
the Fault class to add the cause exception message into the Fault message like this
> {code}
>     public Fault(Message message, Throwable throwable) {
>         super(message, throwable);
>         this.message = message.toString;
>         if (throwable != null) {
>            this.message += "Caused by: " + throwable.getMessage();
>         }
>         code = FAULT_CODE_SERVER;
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.1.4#6159)

Mime
View raw message