0% found this document useful (0 votes)
18 views2 pages

Web Service Ip

1) The document outlines the steps to create and invoke a web service using Glassfish in NetBeans, including creating a project, web service, adding a web method, building and deploying the application, and testing the web service. 2) Key steps include right clicking the project to create a web service called SayHelloService, adding a web method called hello(), building and deploying the project, and testing the web service which returns a greeting message with the input name. 3) The web service is successfully created and invoked, returning "Hello " with the input name.

Uploaded by

vinotha
Copyright
© © All Rights Reserved
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)
18 views2 pages

Web Service Ip

1) The document outlines the steps to create and invoke a web service using Glassfish in NetBeans, including creating a project, web service, adding a web method, building and deploying the application, and testing the web service. 2) Key steps include right clicking the project to create a web service called SayHelloService, adding a web method called hello(), building and deploying the project, and testing the web service which returns a greeting message with the input name. 3) The web service is successfully created and invoked, returning "Hello " with the input name.

Uploaded by

vinotha
Copyright
© © All Rights Reserved
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/ 2

Web Service

Aim:

To create and invoke a Web service using Glassfish in NetBeans.

Procedure:

Step 1: Create project


Open Netbeans >> Select File >> New Project >> Java Web: Web Application
Click Next >> Enter Project name: HelloWorldWebService:
Click Next >> Select Server:
Click Finish

Step 2: Create WebService

Right click on the project HelloWorldWebService >> New >> Web Service:
Enter Web service name: SayHelloService
Enter Package: com.prgguru.example
Click Finish

Step 3: Add/Update web method

Step 4: Clean and build the application

Right click on the project, select Clean and Build.

Step 5: Deploy the application

Right click on the project, select Deploy.

Step 6: Test the webservice

Right click on the web service SayHelloService and select Test Web Service.
It will open up the browser where the service we created can be tested
Enter the name in the textbox and hit hello button, you could see the response from the server
as shown below:
Index.html

<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<form name="f1" method="get" action="SayHelloapp">
<input type="text" name="nm">
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>

Webservice:
SayHelloService.java:

package com.hello1.example;

import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;

/**
*
* @author Student
*/
@WebService(serviceName = "SayHelloapp")
public class SayHelloapp {

/**
* This is a sample web service operation
*/
@WebMethod(operationName = "hello")
public String hello12(@WebParam(name = "name") String txt) {
return "Hello " + txt + " !";
}
}

Result:

Thus the Web service program using Glassfish in Net Beans was created successfully.

You might also like