[jboss-user] [JBoss Web Services] - Unable to deploy a simple web service with WebServiceProvider annotation
raits
do-not-reply at jboss.com
Fri Feb 4 06:25:17 EST 2011
raits [http://community.jboss.org/people/raits] created the discussion
"Unable to deploy a simple web service with WebServiceProvider annotation"
To view the discussion, visit: http://community.jboss.org/message/585470#585470
--------------------------------------------------------------
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
[http://community.jboss.org/message/585470#585470]
Start a new discussion in JBoss Web Services at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110204/11f6b18b/attachment.html
More information about the jboss-user
mailing list