This content has been marked as final.
Show 2 replies
-
1. Re: Web Service - what needs to be in the .war?
peterj Oct 14, 2008 6:48 PM (in response to clarkvalentine)In a WAR filer all you need are the POJO web service and the web.xml.
Simple hello service:package ws.simple; @javax.jws.WebService public class HelloService { @javax.jws.WebMethod public String sayHello(String name) { return "Hello, " + name; } }
The web.xml:<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5" > <servlet> <servlet-name>HelloService</servlet-name> <servlet-class>ws.simple.HelloService</servlet-class> </servlet> <servlet-mapping> <servlet-name>HelloService</servlet-name> <url-pattern>/hello</url-pattern> </servlet-mapping> </web-app>
And the contents of the resulting hello.war:
WEB-INF/web.xml
WEB-INF/classes/ws/simple/HelloService.class
Caveat: The above was transcribed from a slightly more complex web service, so it might have typos, but other than that it should be all you need. -
2. Re: Web Service - what needs to be in the .war?
peterj Oct 14, 2008 6:54 PM (in response to clarkvalentine)If your web service is EJB-based, all you need is a jar file with the web service class.
Add two more annotations to the class:... @javax.jws.Stateless @org.jboss.wsf.spi.annotation.WebContext(contextRoot="/hello", urlPattern="/hello") @WebService public class HelloService {...}
And the contents of hello.jar:
ws/simple/HelloService.class