Cross-Platform, Java

Creating a simple Web Service in Java

Create a web service application project in Netbeans.
Create a class named Customers. In this class we will declare the methods that our service will provide to clients.

1
2
3
4
5
6
7
8
9
10
11
12
13
import javax.jws.WebMethod;
import javax.jws.WebService;
 
@WebService
public class Customers {    
 
    public Customers(){}
 
    @WebMethod
    public String welcome(String customername){
        return "Welcome, " + customername;
    }
}

Deploy the Service and open the following url:
http://localhost:8080/project_name/CustomersService?wsdl

Your Java Web Service is ready to accept clients.