6 Replies Latest reply on Oct 1, 2011 12:58 PM by The Chef

    Problem Accessing Web Service

    David Jayakaran Newbie

      Hi,

      I deployed a very simple web service to JBoss-4.2.0.GA, and used JBoss's wsconsume utility to generates stubs. I ran the client in its own JVM as a java application. It invokes the web service... no problem!

      Then I coded a servlet (actually an Action class much like Struts) to call the web service. In this case the servlet and the web service are deployed within the same EAR. When the servlet invokes the web service from within the same container I get an exception when it tries to get the port. The offending line of code is in the generated service class:
      return (CurrencyWS)super.getPort(new QName("http://currencyconverter.ws/", "CurrencyWSPort"), CurrencyWS.class);


      The exception says:

      javax.xml.ws.WebServiceException: SEI is missing @WebService annotation: interface ws.currencyconverter.CurrencyWS

      All my annotations seem to be fine... the web service deploys fine and a client running in a separate JVM invokes it successfully.

      If I run the web service on one machine and the servlet (web server) on another machine they communicate just fine.

      Can someone tell me what I'm doing wrong?

      Thanks,
      David

        • 1. Re: Problem Accessing Web Service
          David Jayakaran Newbie

          Here's the code I wrote to invoke the web service:

          {
          CurrencyForm form = null;
          CurrencyWSService svc = null;

          form = populateCurrencyForm(); // Souce, target currencies
          svc = new CurrencyWSService();
          CurrencyWS currencyWS = svc.getCurrencyWSPort();

          System.out.println(form);
          form = currencyWS.convertCurrency(form);
          System.out.println(form);
          }

          The exception is thrown at the getCurrencyWSPort() call.

          Here's my Service Endpoint Interface (SEI):

          @WebService(name = "CurrencyWS", targetNamespace = "http://currencyconverter.ws/")
          public interface CurrencyWS
          {
          @WebMethod
          @WebResult(targetNamespace = "")
          @RequestWrapper(localName = "convertCurrency", targetNamespace = "http://currencyconverter.ws/", className = "ws.currencyconverter.ConvertCurrency")
          @ResponseWrapper(localName = "convertCurrencyResponse", targetNamespace = "http://currencyconverter.ws/", className = "ws.currencyconverter.ConvertCurrencyResponse")

          public CurrencyForm convertCurrency(@WebParam(name = "arg0", targetNamespace = "") CurrencyForm arg0);
          }

          I seem to have the necessary @WebService annotation, yet the JBoss container throws the exception (see my previous posting).

          Any thoughts?

          • 2. Re: Problem Accessing Web Service
            David Jayakaran Newbie

            I've tried everything short of looking into JBoss's source code to see why it's throwing the exception:

            Here's a portion of the call stack in the exception:

            javax.xml.ws.WebServiceException: SEI is missing @WebService annotation: interface ws.currencyconverter.CurrencyWS
            at org.jboss.ws.core.jaxws.spi.ServiceDelegateImpl.assertSEIConstraints(ServiceDelegateImpl.java:287)
            at org.jboss.ws.core.jaxws.spi.ServiceDelegateImpl.getPort(ServiceDelegateImpl.java:180)
            at javax.xml.ws.Service.getPort(Service.java:116)
            at ws.currencyconverter.CurrencyWSService.getCurrencyWSPort(CurrencyWSService.java:54)
            at commands.ConvertCurrencyCommand.invokeWebService(ConvertCurrencyCommand.java:76)
            at commands.ConvertCurrencyCommand.execute(ConvertCurrencyCommand.java:59)
            at web.CurrencyConverterServlet.process(CurrencyConverterServlet.java:52)

            Can someone help? If you think you can help but need more info, please reply and I'll post any additional info needed.

            Thanks,
            David

            • 3. Re: Problem Accessing Web Service
              David Jayakaran Newbie

              I'm still having the problem. Am I missing something obvious? Tried everything I know to do... can someone please help?

              • 4. Re: Problem Accessing Web Service
                Alessio Soldano Newbie

                I'd check the deployment; are client and server side sharing classes? JBossWS stack throws that exception when it can't find @WebService annotation on the specified SEI, thus I suspect the class it's checking for annotation is not what you think it should be (classloading issue?)
                Bye
                Alessio Soldano

                http://www.javalinux.it

                • 5. Re: Problem Accessing Web Service
                  David Jayakaran Newbie

                  Thanks Alessio. I'll check your suggestion out and post a reply when I resolve the problem.

                  David

                  • 6. Re: Problem Accessing Web Service
                    The Chef Newbie

                    Hi,

                     

                    I have a similiar problem. Do you have resolved it?

                     

                    Thx.