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

    problem throwing SOAPFaultException

      Hello,

      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/">
       <env:Header/>
       <env:Body>
       <env:Fault>
       <faultcode>env:Client</faultcode>
       <faultstring>java.rmi.ServerException: RuntimeException; nested exception is:
       javax.xml.rpc.soap.SOAPFaultException: faultString</faultstring>
       </env:Fault>
       </env:Body>
      </env:Envelope>


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

      any solution/workaround available?

      regards!

      /Ole
      eviware.com

        • 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();
           }
           else
           {
          ...


          fixed the problem (at least temporarily)..

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

          regards!

          /Ole
          eviware.com

          • 2. Re: problem throwing SOAPFaultException
            kapil.singhal

            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?