8 Replies Latest reply on Oct 27, 2006 12:18 AM by Jason Greene

    JSR 181 JBoss 4.0.4

    Massimiliano Fancoli Newbie

      This not Works

      @WebMethod
      public void doReport(@WebParam(name = "user") String user, @WebParam(name = "pwd") byte[] pwd, @WebParam(name = "terminal") String terminal, @WebParam(name = "amid") int amid, @WebParam(name = "reportId") String reportId) throws Exception {
      }
      and I receive this exception during deployment

      org.jboss.ws.WSException: Element message found in jaxrpc-mapping but not in the schema: {http://webservice.wsdl/WbsReport}Exception

      if I remove throws Exception all works fine
      @WebMethod
      public void doReport(@WebParam(name = "user") String user, @WebParam(name = "pwd") byte[] pwd, @WebParam(name = "terminal") String terminal, @WebParam(name = "amid") int amid, @WebParam(name = "reportId") String reportId){
      }

      Is it a bug ?

        • 1. Re: JSR 181 JBoss 4.0.4
          lupson Newbie

          Having exactly the same issue...any luck yet?

          • 2. Re: JSR 181 JBoss 4.0.4
            lupson Newbie

            I solved a few problems that others may encounter, so here goes:

            1. Throwing Exceptions. Well - declaring a @WebMethod to throw an Exception or some user-defined Exception, extending Exception would cause the "org.jboss.ws.WSException" described in the first post. I got JBoss 4.0.4.GA to get past this by declaring "throws Throwable" instead. It works nicely.

            2. Actually throwing a useful Exception. Im using a C# console application as test client since this project will have a ASP.NET / C# frontend. Error management needed to be handled using some kind of customized Exceptions since I use arbitrary objects as return types (various business objects). I took a quick shot at using a generic "MyResponse" class but that did not work out for various reasons. Ok, back to throwing "normal" Exceptions. This could be done, but every time, the C# client would only be able to access the "message" part of any exception, not giving me enough flexibility. I continued with various kinds of SOAP-like exceptions: SOAPException, SOAPFaultException from javax.xml.ws, SOAPFaultException javax.xml.rpc and so on, manually setting the Detail node, Actor, Code and similar stuff.

            Nevertheless - each time the C# would only show the message. Accessing the Detail node would give the C# eq. of NullPointerException.

            During all this time I noticed a "strange" thing in my JBoss server.log - a stacktrace was being printed for each Exception I threw - an EJBException - but I was not responsible for that stacktrace!

            Suddenly I realized something - since the JSR-181 endpoint also is a stateless session EJB the fine SOAPException Im throwing might get wrapped by the EJB framework. Well - I turned off container managed transactions using:

            @TransactionManagement( value=TransactionManagementType.BEAN)

            Now it works as a charm! I can easily access the various parts of the SOAPException in the C# app.

            Well - hopefully this little essay can be helpful to someone.

            • 3. Re: JSR 181 JBoss 4.0.4
              Thomas Diesler Master

              http://jira.jboss.org/jira/browse/JBWS-1158

              Note, @WebFault is not yet supported in jbossws-1.0.3

              • 4. Re: JSR 181 JBoss 4.0.4
                Kevin Gaasch Newbie

                what revision of jbossws is @webFault going to be supported in?

                • 6. Re: JSR 181 JBoss 4.0.4
                  Alexander Schlett Newbie

                  I'm having a similar issue. Whatever throws I declare in the @WebMethod, if it's a custom exception or just Throwable, it deploys fine, but I can't create a webservice client from the wsdl because it says "The part 'Throwable' has an invalid value 'Throwable' defined for this element."
                  I'm using JbossIDE2 for client generation.
                  Please, any help is appreciated.

                  • 7. Re: JSR 181 JBoss 4.0.4
                    Alexander Schlett Newbie

                    this is what I love about the jboss support forums, you can ask lots of questions, also find similar questions of other users, and you can be sure you'll get either no answer at all or something saying it's your fault or fix it yourself or that it is fixed in a future version that will be released in a year or so. thanks!

                    • 8. Re: JSR 181 JBoss 4.0.4
                      Jason Greene Master

                       

                      "ax666" wrote:
                      this is what I love about the jboss support forums, you can ask lots of questions, also find similar questions of other users, and you can be sure you'll get either no answer at all or something saying it's your fault or fix it yourself or that it is fixed in a future version that will be released in a year or so. thanks!


                      I am sorry for the delay but please understand that we have been very busy on implementing JAX-WS which is has been under high demand from the community and our customers. If you need more expedient answers then consider getting a support contract..

                      Now to answer your question, Since this is based off of the JAX-RPC spec, you have to throw either a runtime exception, remote exception, or a user defined checked exception that must extend Exception. You can't directly throw the base exception class. Throwable shouldn't be allowed either, so thats a bug. The error message should be clearer.

                      -Jason