Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
53 views15 pages

Experiment 1-3, WSS Abhiraj

This document contains a student's practical file for their Web Services Security Lab course. It includes the student's details, the course name and code, and summaries of 3 experiments conducted. The experiments involve implementing a hello world web service, a calculator web service, and a product information retrieval web service. Each experiment listing includes the aim, tools required, description, steps, and code for the web service created.

Uploaded by

Shashank Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views15 pages

Experiment 1-3, WSS Abhiraj

This document contains a student's practical file for their Web Services Security Lab course. It includes the student's details, the course name and code, and summaries of 3 experiments conducted. The experiments involve implementing a hello world web service, a calculator web service, and a product information retrieval web service. Each experiment listing includes the aim, tools required, description, steps, and code for the web service created.

Uploaded by

Shashank Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 15

PRACTICAL FILE

Student Name LAKSHAY CHOUDHARY


UID 19BCS2711
Section & 19BCS-14 Group-A
Group
Department Computer Science & Engineering
Session Aug-Dec 2022
Course Name Web Services Security Lab
Course Code CSB-422
Semester 7TH

NAME: LAKSHAY CHOUDHARY UID: 19BCS2711


Course Name: Web Services Security Lab
Course Code: CSB-422

Experiment: 1

Aim: Write a program to implement helloWorld web service

Tools/Software Required: Netbeans IDE , Glassfish server , Any web browser.

Description: To implement a WSDL web service

Pseudo code/Algorithms/Flowchart/Steps:
Step 1: Navigate to File -> New Project -> Java Web -> Web Application. Here give
your web service a suitable name.
Step 2: Under web services tab we can locate java file where codes can be written or
modified.
Step 3: After completion of code, right click on the name of project and choose to clean
and build.
Step 4: Again right click on the project name and choose Deploy, to deploy your web
service.
Step 5: Finally right click on java file to choose the option “Test your web service” to test it
on your local host computer

Code:

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

@WebService(serviceName = "HelloWorld")
public class hello {
Name: LAKSHAY CHOUDHARY UID: 19BCS2711
@WebMethod(operationName = "Hello")
public String HelloWorld(@WebParam(name = "name") String name)
{ //TODO write your implementation code here: return "hello "+name;

}
}

Output:

Name: LAKSHAY CHOUDHARY UID: 19BCS2711


Name: LAKSHAY CHOUDHARY UID: 19BCS2711
Course Name: Web Services Security Lab
Course Code: CSB-422

Experiment: 2

Aim: Write a program to implement a calculator web service.

Tools/Software Required: Netbeans IDE , Glassfish server , Any web browser.

Description: To implement a WSDL web service

Pseudo code/Algorithms/Flowchart/Steps:
Step 1: Navigate to File -> New Project -> Java Web -> Web Application. Here give
your web service a suitable name.
Step 2: Under web services tab we can locate java file where codes can be written or
modified.
Step 3: After completion of code, right click on the name of project and choose to clean
and build.
Step 4: Again right click on the project name and choose Deploy, to deploy your
web service.
Step 5: Finally right click on java file to choose the option “Test your web service”
to test it on your local host computer.

Code:
package addition;

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

@WebService(serviceName = "HelloWorld")
public class Addition {

//addition
@WebMethod(operationName = "add2Numbers")

Name: LAKSHAY CHOUDHARY UID: 19BCS2711


public Integer add2Numbers(@WebParam(name = "a") int a, @WebParam(name
= "b") int b) {
//TODO write your implementation code here:

return a+b;
}

//subtraction

@WebMethod(operationName = "Subtract2Numbers")
public Integer Subtract2Numbers(@WebParam(name = "x") Integer
x, @WebParam(name = "y") Integer y) {
//TODO write your implementation code here:
return x-y;
}

//multiplication
@WebMethod(operationName = "multiply")
public Integer multiply(@WebParam(name = "l") int l, @WebParam(name =
"m") int m) {
//TODO write your implementation code here:
return l*m;
}
//division

@WebMethod(operationName = "devision")
public Integer devision(@WebParam(name = "c") int c, @WebParam(name =
"d") int d) {
//TODO write your implementation code here:
return c/d;
}

Output:

Name: LAKSHAY CHOUDHARY UID: 19BCS2711


Name: LAKSHAY CHOUDHARY UID: 19BCS2711
Name: LAKSHAY CHOUDHARY UID: 19BCS2711
Name: LAKSHAY CHOUDHARY UID: 19BCS2711
Course Name: Web Services Security Lab
Course Code: CSB-422

Experiment: 3

Aim: Write a program to implement get product information


using getPrice() and getProduct() operations

Tools/Software Required: Netbeans IDE , Glassfish server , Any web browser.

Description: To implement a WSDL web service

Pseudo code/Algorithms/Flowchart/Steps:
Step 1: Navigate to File -> New Project -> Java Web -> Web Application. Here give
your web service a suitable name.
Step 2: Under web services tab we can locate java file where codes can be written or
modified.
Step 3: After completion of code, right click on the name of project and choose to clean
and build.
Step 4: Again right click on the project name and choose Deploy, to deploy your web
service.
Step 5: Finally right click on java file to choose the option “Test your web service” to test it
on your local host computer.

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

Name: LAKSHAY CHOUDHARY UID: 19BCS2711


/**
*
* @author
*/
@WebService(serviceName =
"Expermint3") public class add2no {
/**
* This is a sample web service operation*/
public int getprice(@WebParam(name = "name") String name) {
int k=0;
switch(name){
case "Mobile":
k=50000;
break;
case "TV":
k= 20000;
break;
}
return k;
}
public int getproduct(@WebParam(name = "name") String name) {
int k=0;
switch(name){
case "Mobile":
k=500;
break;
case "TV":
k= 200;
break;
}
return k;
}
}

Name: LAKSHAY CHOUDHARY UID: 19BCS2711


Output:

Name:LAKSHAY CHOUDHARY UID: 19BCS2711


Name:LAKSHAY CHOUDHARY UID: 19BCS2711
INDEX
S. N. Experiment Date of Conduct Viva Record Total Teacher’s
Experiment (12 marks) (10 marks) (08 marks) (30 marks) Signature
implement helloWorld web
1 service. 02/08/2022

Write a program to
implement a calculator web
2 service. 09/08/2022

Write a program to
implement get product
3 16/08/2022
information using
getPrice() and getProduct()
operations

NAME: LAKSHAY CHOUDHARY UID: 19BCS2711

You might also like