0 Replies Latest reply on Feb 3, 2012 4:32 PM by camilo casadiego

    Which is the correct way to handle exceptions and messages througth webservices???

    camilo casadiego Newbie

      Hi there, Im facing a challenge on a seam platform development.

       

      I have and overall architecture defined by a enterpise aplication buid up on seam, such aplication has dome EJB exposed to the web interface and also to q seb service facade.

       

      When somethong bad happens from the web page, everithing works just as spected, this is...the exception is thrown, the transaction is rolled back, and seam manages gracefully the message to the final user, now the problem is that when this escenario happens on the webservice facade, the client just fails with and internal sun exception :s

       

      the eception i got in the client is:

       

      Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError

          at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:107)

          at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)

          at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107)

       

      Now, what I whant to do is simethong like this...

       

      } catch (Exception e) {

                  //first we roll bakc the operation

                  entityManager.getTransaction().rollback();

                  log.fatal(null, e);

                  returnValue.setFail(true);

                  returnValue.setErrorMessage(e.getMessage());

                  returnValue.setItem(baseItem);

                  entityManager.getTransaction().rollback();

              }

       

      so whe an exception is thrown, i rolback the operation (i already triyed not doing anithing, the rollbakc fomr seam, the rollback from hibernate and nothign seams to work)

       

      The only thing that i want to do is to catch the error in the ws layer, and handle it in order to send the client an specific mesage, and also rollback the failed operations