Apparently, creating and deploying an web service with Java EE 7 is just as easy as it was with Java EE 6. This maybe due to the fact, that support for web services and SOAP in JAX-WS hasn’t changed much since Java EE 6, as Adam Bien points out here: The State of SOAP / JAX-WS. However, just for the record, here’s the basic code needed to provide a simple web service:
package [...];
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class Hello
{
private final String message = new String("Hello, ");
public Hello()
{}
@WebMethod
public String sayHello(final String name)
{
return message + name + ".";
}
}
Simply compile and deploy the WAR file (e.g. YourApplicationName.war
), e.g. into \standalone\deployments
of the standalone Wildfly installation. You should now be able to access the generated WSDL under http://localhost:8080/YourApplicationName/Hello?wsdl
.
Is web.xml descriptor required ?
Hi Rafal,
as far as I know, you don’t need a
web.xml
.Best regards,
Stefan