What I'm trying to do is create a simple web service. I'm following
CodePudding user response:
If you want to implement a SOAP WebService then start with New Project - Java Enterprise and choose Web application.
Here I use GlassFish 5.1 and JDK 1.8.
On the next step add dependency on JAX-WS:
Then, add your WebService class:
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class HelloWebService {
@WebMethod
public String sayHello(String name) {
return "Say Hello to " name;
}
}
Now, you can run GlassFish deployment and check the web service URL in GlassFish Log tab:
Finally, you will be able to see web service page: