JBoss supports JAX-WS out of the box. There is not much configuration files needed, only a servlet-mapping in the web.xml. This is how the web-service java file looks like:
package com.swayam.demo.webservice;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
/**
*
* @author paawak
*/
@WebService()
public class UserService {
/**
* Web service operation
*/
@WebMethod(operationName = "addUser")
public Boolean addUser(@WebParam(name = "userName")
String userName) {
System.out.println("add user");
return Boolean.TRUE;
}
}
Its a POJO with a @WebService annotation. All you have to do is map this as a servlet in the desired context. Though this is not a servlet per-se, the JBoss web container does the rest. This is how the web.xml looks like:
UserService
com.swayam.demo.webservice.UserService
1
UserService
/UserService
30
index.jsp
After deploying, you can access the webservice by http://localhost:8080/JBossWebServiceTest/UserService?wsdl.
You can find the sources https://github.com/paawak/blog/tree/master/code/JBossWebServiceTest
And the war https://github.com/paawak/blog/tree/master/code/JBossWebServiceTest/dist