[jboss-user] [JBoss Web Services] - Re: Is it possible to create JBoss web service without EJB?

Peter Johnson do-not-reply at jboss.com
Mon Jul 30 14:39:48 EDT 2012


Peter Johnson [https://community.jboss.org/people/peterj] created the discussion

"Re: Is it possible to create JBoss web service without EJB?"

To view the discussion, visit: https://community.jboss.org/message/751059#751059

--------------------------------------------------------------
Yes you can. Just package the web service in a WAR and deploy. Here's a simple class for a hello web service:

package my.web.service;
import javax.jws.WebService;
import javax.jws.WebMethod;
 
@WebService()
public class Hello {
  @WebMethod()
  public String hello(String name) {
    return "Hello " + name;
  }
}
and here is the web.xml for it:
<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>Hello</servlet-name>
    <servlet-class>my.web.service.Hello</servlet-class>
  </servlet>
 
  <servlet-mapping>
    <servlet-name>Hello</servlet-name>
    <url-pattern>/hello</url-pattern>
  </servlet-mapping>
</web-app>
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/751059#751059]

Start a new discussion in JBoss Web Services at Community
[https://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/20120730/a98283d8/attachment.html 


More information about the jboss-user mailing list