I am working on Eclipse IDE and creating a web-service program. IDE gives an error while importing
import javax.jws.WebService;
import javax.jws.WebMethod;
error shows the import javax.jws can not be resolved
import javax.jws.WebService;
import javax.jws.WebMethod;
@WebService
public class Hello {
    private final String message = "Hello, ";
    public Hello() {
    }
    @WebMethod
    public String sayHello(String name) {
        return message + name + ".";
    }
}
                Check that your project has appropriate JDK.
Right click on the project --> Properties --> Compiler
I created your file in Java8, and it worked.

in the pom.xml file add
<dependency>
  <groupId>javax.jws</groupId>
  <artifactId>javax.jws-api</artifactId>
  <version>1.1</version>
</dependency>
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With