Home > front end >  IntelliJ: Create WebService and no WebApplication option
IntelliJ: Create WebService and no WebApplication option

Time:12-27

What I'm trying to do is create a simple web service. I'm following enter image description here

CodePudding user response:

If you want to implement a SOAP WebService then start with New Project - Java Enterprise and choose Web application.

enter image description here

Here I use GlassFish 5.1 and JDK 1.8.

On the next step add dependency on JAX-WS:

enter image description here

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:

enter image description here

Finally, you will be able to see web service page:

enter image description here

  • Related