2 Replies Latest reply on Oct 12, 2006 10:09 AM by kapil.singhal

    problem throwing SOAPFaultException


      I want to throw a custom SOAP Fault so I am trying to throw a SOAPFaultException from within my EJB21 Webservice:

      throw new SOAPFaultException( new QName( "test" ), "faultString", "faultActor", detail );

      unfortunately, this get serialized as

      <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
       <faultstring>java.rmi.ServerException: RuntimeException; nested exception is:
       javax.xml.rpc.soap.SOAPFaultException: faultString</faultstring>

      I was hoping to get my actual faultString/faultActor values in the returned fault..

      any solution/workaround available?



        • 1. Re: problem throwing SOAPFaultException

          ok.. I've fixed this in the 1.0.3 sources locally; in org.jboss.ws.server.ServiceEndpointInvoker#handleInvocationException(Throwable) the handled exception is an MBeanException which wraps a ServerException which wraps the "original" SOAPFaultException.. I added a check for this;

          if (th instanceof MBeanException)
           Exception targetEx = ((MBeanException)th).getTargetException();
           if (targetEx instanceof SOAPFaultException)
           throw (SOAPFaultException)targetEx;
           else if( targetEx instanceof ServerException && targetEx.getCause() instanceof SOAPFaultException )
           throw (SOAPFaultException)((ServerException)targetEx).getCause();

          fixed the problem (at least temporarily)..

          should I post a bug-report/fix/etc in JIRA?



          • 2. Re: problem throwing SOAPFaultException

            Thanks for the hint.

            Please suggest me how you have filled the Detail object of the exception. Specifically I would like to know which implementation class you have used.

            Is it to possible for you to share some code snippet?