3 Replies Latest reply on Feb 10, 2011 11:01 AM by raits

    Unable to deploy a simple web service with WebServiceProvider annotation

    raits Newbie

      Hello, I'm trying to build a simple web service using javax.xml.ws.WebServiceProvider. The code compiles fine and no errors are reported while deploying in JBoss but when I try to load the wsdl I get an error message stating the class isn't a servlet.


      The code for the provider itself:

      package org.raits;
      import java.io.StringWriter;
      import javax.servlet.http.HttpServlet;
      import javax.xml.transform.Source;
      import javax.xml.transform.Transformer;
      import javax.xml.transform.TransformerFactory;
      import javax.xml.transform.stream.StreamResult;
      import javax.xml.ws.Provider;
      import javax.xml.ws.ServiceMode;
      import javax.xml.ws.WebServiceProvider;
      @WebServiceProvider(wsdlLocation = "WEB-INF/Test.wsdl")
      public class TestService implements Provider<Source>{
          public Source invoke(Source request) {
                  StringWriter requestXmlWriter = new StringWriter();
                  Transformer trans = TransformerFactory.newInstance().newTransformer();
                  trans.transform(request, new StreamResult(requestXmlWriter));
              }catch(Exception e){
              return null;


      And I'm mapping it my web.xml file as follows:




      I'm also using a fairly old JBoss build (Release ID: JBoss [Zion] 4.0.4.GA (build: CVSTag=JBoss_4_0_4_GA date=200605151000)), which I can't upgrade due to the rest of the system tied into it. A regular @WebService worked just fine using this method, am I missing something in the setup?


      Any help would be greatly appreciated.


      Thank you in advance