I have an EAR file with a nested EJB project, a .war dynamic web project, and a .jar file containing entity bean definitions.
I’m trying to make a simple SOAP-based web service using this remote interface:
package session;
import javax.ejb.Remote;
import javax.jws.WebMethod;
import javax.jws.WebService;
@Remote
@WebService
public interface HelloWorldRemote {
@WebMethod
public String greet(String from);
@WebMethod
public String getMessage();
}
and this implementation class:
package session;
import javax.ejb.Stateless;
import javax.jws.WebService;
@Stateless
@WebService(endpointInterface = "session.HelloWorldRemote", serviceName = "HelloWorldWS")
public class HelloWorldImpl implements HelloWorldRemote {
public String greet(String from) {
return "Hello, " + from + ".";
}
public String getMessage() {
return "It's working.";
}
}
However, when I deploy the EAR file, the log makes no mention of either class, WSDL, webservices, or anything that would lead me to believe that it’s making an attempt to create the webservice based on my annotations.
What am I missing?
This took far too long to discover and I came across it quite by accident. I found a forum explaining that I needed to use the ” –server-config=standalone-preview.xml” flag to enable support for certain pieces of JBoss functionality. After trying to find out where standalone-preview.xml could be found/acquired, I learned that I’ve been using the wrong version of JBoss.
Counter-intuitively, the “Web” profile of JBoss 7 does not support Web services. (At least not those of the JAX-WS variety.)
The solution was to download the “Everything” profile and then use the above flag. If you’re working in Eclipse as I was, you may add the flag by double-clicking on your server in the “servers” tab at the bottom, then hitting “Open Launch Configuration”.
I hope I saved someone else as many hours as I spent tracking this down.