JBoss Community

Unable to deploy a simple web service with WebServiceProvider annotation

created by raits in JBoss Web Services - View the full discussion

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")
@ServiceMode(value=javax.xml.ws.Service.Mode.MESSAGE)
public class TestService implements Provider<Source>{
 
 
    @Override
    public Source invoke(Source request) {
        try{
            StringWriter requestXmlWriter = new StringWriter();
            Transformer trans = TransformerFactory.newInstance().newTransformer();
            trans.transform(request, new StreamResult(requestXmlWriter));
            System.out.println(requestXmlWriter.toString());
        }catch(Exception e){
            e.printStackTrace();
        }
        return null;
    }
}

 

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

 

<servlet>
    <servlet-name>TestService</servlet-name>
    <servlet-class>
        org.raits.TestService
    </servlet-class>
</servlet>


<servlet-mapping>
    <servlet-name>TestService</servlet-name>
    <url-pattern>/TestService/*</url-pattern>
</servlet-mapping>

 

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

Raits

Reply to this message by going to Community

Start a new discussion in JBoss Web Services at Community