Components As Web Services
Components As Web Services
web folder->web Application Step2: Give the project name as addserver->press finish button Step 3: Select the project name (addserver)->new->webservice Step 4: web service name as ->addweb->package name as->org->finish (ok) Step 5: Design window->click addoperation->name->add-return type->int Step 6: Addoperation ->parameter name ->a->type->int Similarly b>type->int->ok Step7: To add two-parameter and parameter type (int a, int b) Step 8: see the project tab->extract webservice->addweb->right click->test webservice Step 9: addserver->rightclick->undeploy deploy Step10: see the project tab->extract webservice->addweb->right click->test webservice Step11: enter values 3 and 4 and ->click add button
Program: //open source tap-write the following code import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebService; /** * * @author rav */ @WebService() public class addweb { /** * Web service operation */ @WebMethod(operationName = "add") public int add(@WebParam(name = "a") int a, @WebParam(name = "b") int b) { //TODO write your implementation code here: int k=a+b; return k; } } Step1: Netbeans->new->newproject->select web folder->web Application
Output:
Result: