0 Replies Latest reply on Mar 8, 2007 10:12 AM by Marco Pehla

    [EJB3 WebService] How handle SOAPException better?

    Marco Pehla Newbie

      Hello everybody,


      I've some problems with the SOAPException handling. I wrote a EJB3 with @WebMethods and JBoss generates automatically the corresponding WSDL catalogue. In order to get a declaration of a fault message inside the WSDL, I have to throw a SOAPException in my @WebMethod.

      e.g.

      @WebMethod
      public String doSomething(String input) throws SOAPException {
      
       String result = "Hello World!";
      
       if(input.equals("")) {
       throw new SOAPException("No input specified.");
       }//if
      
      return result;
      }//doSomething()
      


      My client is written in PHP and able to handle SOAPExceptions like desired. If I send an empty request to my Web Service then JBoss sends a SOAPException back to the PHP client which handles this exception.

      Everytime the Web Service creates a SOAPException, I get a really huge output on my JBoss console.

      How could I avoid this? I mean, is it possible to handle this exceptions by myself? Or is this the normal behaviour of a SOAPException?

      PS: I know, I could put this "throw new SOAPException" inside of a try-catch block, but as everybody know the client of the Web Service gets then no SOAPException message. So I need to let the exception be handled by the EJB container. Or have I to do it in the catch block?)


      with kind regards,
      Marco