Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-2021

SOAPFault detail is not set in WebServiceException/SOAPFaultException that is thrown from dispatch.invoke

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1.3
    • 2.1.4
    • JAX-WS Runtime
    • None
    • Windows XP, Jdk 1.5, tomacat 5.5.

    Description

      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>

      Attachments

        Activity

          People

            dkulp Daniel Kulp
            yfei Yunfeng Fei
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: