Fortunately for you, I actually just finished spending quite a few hours
researching how to run JAX-WS POJO web services in Tomcat, with success :).
First off, JBossWS 2.0 doesn't support Tomcat (though it *may* work); only 1.x
does. It also seems to require web services to be bundled separately from the
main application WAR (AFAIK). Because of those things, JBossWS was out of the
running for me.
The only webservice framework I was able to find that supported
production-quality webservices in the main WAR was Apache CXF 2.0. So far, it
seems to work very nicely, though it doesn't integrate with Seam conversations
(Seam only has a handler for JBossWS for that currently, though one for CXF
could likely be easily created).
I probably should write a tutorial in the Wiki for setting CXF up, but in the
meantime here's how I got a basic HelloWorld up and running in my Seam app:
pom.xml (if you use Maven):
<dependency>
| <groupId>org.apache.cxf</groupId>
| <artifactId>cxf-rt-frontend-jaxws</artifactId>
| <version>2.0.2-incubator</version>
| <exclusions>
| <exclusion>
| <!-- A large (2+mb) dependency that doesn't
appear to be needed -->
| <groupId>com.sun.xml.bind</groupId>
| <artifactId>jaxb-xjc</artifactId>
| </exclusion>
| </exclusions>
| </dependency>
| <dependency>
| <groupId>org.apache.cxf</groupId>
| <artifactId>cxf-rt-transports-http</artifactId>
| <version>2.0.2-incubator</version>
| </dependency>
HelloWorld.java:
package com.demo.webservice;
|
| import javax.jws.*;
| import javax.jws.soap.SOAPBinding;
| import javax.jws.soap.SOAPBinding.*;
|
| @WebService
| @SOAPBinding(parameterStyle=ParameterStyle.BARE)
| public interface HelloWorld{
| String sayHi(@WebParam(name="addressee") String text);
| }
HelloWorldImpl.java:
package com.demo.webservice;
|
| import javax.jws.WebService;
|
| @WebService(endpointInterface = "com.demo.webservice.HelloWorld",
| serviceName = "HelloWorld")
| public class HelloWorldImpl implements HelloWorld{
|
| public String sayHi(String text) {
| return "Hello " + text;
| }
| }
cxf-servlet.xml (in WEB-INF):
<beans xmlns="http://www.springframework.org/schema/beans"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xmlns:jaxws="http://cxf.apache.org/jaxws"
| xmlns:soap="http://cxf.apache.org/bindings/soap"
| xsi:schemaLocation="
| http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
| http://cxf.apache.org/bindings/soap
http://cxf.apache.org/schemas/configuration/soap.xsd
| http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
|
| <jaxws:endpoint
| id="hello_world"
| implementor="com.demo.webservice.HelloWorldImpl"
| address="/hello_world">
| </jaxws:endpoint>
| </beans>
Added into your web.xml:
<servlet>
| <servlet-name>cxf</servlet-name>
|
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
| <load-on-startup>1</load-on-startup>
| </servlet>
| <servlet-mapping>
| <servlet-name>cxf</servlet-name>
| <url-pattern>/services/*</url-pattern>
| </servlet-mapping>
That's it! Just open your browser to http://host:port/context/services/, and it
should give a link to the webservice's WSDL file.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4104691#4104691
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4104691
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user