[ 
https://issues.apache.org/jira/browse/CXF-2021?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniel Kulp resolved CXF-2021.
------------------------------

       Resolution: Fixed
    Fix Version/s: 2.1.4
         Assignee: Daniel Kulp

> SOAPFault detail is not set in WebServiceException/SOAPFaultException that is 
> thrown from dispatch.invoke
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: CXF-2021
>                 URL: https://issues.apache.org/jira/browse/CXF-2021
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-WS Runtime
>    Affects Versions: 2.1.3
>         Environment: Windows XP, Jdk 1.5, tomacat 5.5.
>            Reporter: Yunfeng Fei
>            Assignee: Daniel Kulp
>             Fix For: 2.1.4
>
>
> I'm using the dispatch mechanism to invoke a soap service in message mode.
>  
> Upon catching the WebServiceException thrown by the dispatch.invoke method, i 
> try to extract the soap fault information from it (if it is a 
> SOAPFaultException). That's when i realized the SOAPFault detail is missing 
> (is null). The code i'm using is shown below. Also shown is the returned soap 
> fault with detail when the same service is called using SOAPUI.
> It appears the SOAPFault detail is not set when it is wrapped into a 
> SOAPFaultException and thrown as a WebServiceException.
>         //It appears that the JAX-WS implementation in 
>       //cxf simply does not set the optional SOAPFault Detail object 
>       //in the SOAPFault object wrapped by the SOAPFaultException
>         private SOAPMessage 
> createFaultMessageFromWebServiceException(WebServiceException wse) throws 
> SOAPException {
>               SOAPMessage msg = getNewSOAPMessage();
>               if (wse instanceof SOAPFaultException) {
>                       SOAPFault fault = ((SOAPFaultException) wse).getFault();
>                         //fault.hasDetail() return false
>                       msg.getSOAPBody().addFault(fault.getFaultCodeAsQName(), 
> fault.getFaultString());
>               } else {
>                       
> msg.getSOAPBody().addFault().setFaultString(wse.getMessage());
>               }
>               return msg;
>       }
> The same service invoked through SOAPUI returns SOAPFault message with detail.
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>
>    <soap:Body>
>       <soap:Fault>
>          <faultcode>soap:Server</faultcode>
>          <faultstring>Fault occurred while processing.</faultstring>
>          <detail>
>             <ns8:apiFault errorCode="item not found" objectName="0" 
> objectType="categoryset" .../>
>          </detail>
>       </soap:Fault>
>    </soap:Body>
> </soap:Envelope>

-- 
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