0% found this document useful (0 votes)
40 views8 pages

Components As Web Services

The document provides steps to create a Java web service component that adds two integer parameters and returns the sum. It involves creating a Netbeans web application project, adding a web service, designing an add operation that takes int parameters a and b, implementing the add method to return a+b, deploying and testing the web service by entering sample parameter values.

Uploaded by

Divya Bharathi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views8 pages

Components As Web Services

The document provides steps to create a Java web service component that adds two integer parameters and returns the sum. It involves creating a Netbeans web application project, adding a web service, designing an add operation that takes int parameters a and b, implementing the add method to return a+b, deploying and testing the web service by entering sample parameter values.

Uploaded by

Divya Bharathi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Components as web services Aim: To create component using in java and deploy it using webservice Algorithm Step1: Netbeans->new->newproject->select

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

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: Step8: see the project tab->extract webservice->addweb->right click->test webservice

Step11: enter values 3 and 4 and ->click add button

Output:

Result:

You might also like