Cloud Computing and Web Service Practicals
Cloud Computing and Web Service Practicals
MUMBAI UNIVERSITY
LAB MANUAL
of B.Sc. (CS) Semester VI, Roll No. has successfully completed the practicals in
the subject of Cloud Computing and Web Services as per the requirement of University of Mumbai in
part fulfillment for the completion of Degree of Bachelor of Science (Computer Science). It is also to
certify that this is the original work of the candidate done during the academic year 2024-2025.
H.O.D
DEPARTMENT OF C.S.
2
INDEX
Sr.No. Practical’s Date Sign
1 Define a simple services like Converting Rs into Dollar and
Call it
from different platform like JAVA and .NET
2 Create a Simple SOAP service to find the Square of a
Number
3 Create a Simple REST Service to demonstrate CRUD
operations with “Student” database
4 Develop application to consume Google’s search / Google’s
Map RESTful Web service.
3
Practical-1(A)
Define a simple services like Converting Rupees into Dollar and Call it from different platform
like JAVA.
4
Step 2: To create Web Service “ ConvertWebService”
5
Here Covert is a method having one parameter as rps
6
Code of Operation :
@WebMethod(operationName = "Convert")
public Double Convert(@WebParam(name = "rps") double rps)
{
double d;
d=rps/83.5;
return d;
}
7
After testing
8
Now insert the code to create html page :
< 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 method="get" action="Output.jsp">
<p>"Enter Currency in Ruppes " <input type="text" name="rsptxt"></p>
<p><input type="Submit" value="Convert"></p>
</form>
</body>
</html>
Step 7 :
Now to create web service client, for same right click on project and select new thenselect
web service client you will get the following screen:
9
Step 8: Now finally to create Output.jsp page for output
10
Code to Output.jsp page
<%
try {
p2.CurrencyConvert_Service service = new p2.CurrencyConvert_Service();
p2.CurrencyConvert port = service.getCurrencyConvertPort();
11
Step 10 : Run the application. The following output will be genereted
Output :
12
13
Practical-1(B)
Define a simple services like Converting Rupees into Dollar and Call it from different platform
like .NET
14
Now to Create a web Service :
15
After click on Add button, CurrConvertService.asmx.cs file will be automatically opened.
Add the following code into Class CurrConvertService :
Save the changes. And run the project. A window will open in browser and that is the web service
16
Now click on Service Description option. Now a new window will be opened. The link is selected and
copied. We will use this link in NetBeans to consume this service
17
Now NetBeans is opened.
To Create a Web Application with name CurrConvertServiceClient. Next -> Finish
18
WSDL URL is selected and pasted the link that is copied from browser on run of Visual Studio.
After that click on Finish button.
Now a JSP page is created. Right click on CurrConvertServiceClient -> New -> JSP
Right clicked between body tag and selected-> Call Web Service Operation
19
Now Input.html file of CurrConvertServiceClient project is created and opened and the contents of body
tag is replaced with following code. And then saved it.
<form action="Output.jsp">
<p>Enter Currency in Ruppes : <input type="text" name="txtrs"></p>
<p><input type="submit" value="Convert"></p>
</form>
20
Now the web application is run.
21
Practical-2
22
Step 3 : to Add Operation “Sqr_Find” to Web Service
23
Here Sqr_Find is a method having one parameter as n
Code of Operation :
@WebMethod(operationName = "Sqr_Find")
public Integer Sqr_Find(@WebParam(name = "n") int n)
{
int s;
s=n*n;
return s;
}
24
Step 5 : Now to deploy the web service and Test
iii) Deploy
After testing
25
Successfully Deployed and Tested
26
Now insert the code to create html page :
<html>
<head>
<title>Number Window</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<form action="Output.jsp">
<p>Enter the Number : <input type="text" name="txtnum"></p>
<p><input type="submit" value="Find_SQR"></p>
</form>
</body>
</html>
Step 7 :
Now to create web service client, for same right click on project and select new thenselect
web service client you will get the following screen:
27
Step 8: Now finally to create Output.jsp page for output
28
Step 9: After creating the page code is to be added
29
Code to Output.jsp page
<%
try {
p1.SqrFindService_Service service = new p1.SqrFindService_Service();
p1.SqrFindService port = service.getSqrFindServicePort();
int n =Integer.parseInt(request.getParameter("txtnum"));
java.lang.Integer result = port.sqrFind(n);
out.println("Square of "+n+" is "+result);
}
catch (Exception ex)
{
}
%>
30
Output :
31
Practical-3
2. Right click on Java DB and then click on Start Server to start the server .
3. Now expand Java DB and right click on sample and then click on connect to connect the
sample database with server.
32
4. Now create a web application with the name CRUD_Operation. A window will open like
following pic.
33
5. Create an entity class. Right click on project name -> New -> Entity Class.
6. A window will appear like bellow pic. Enter following data and click on Next ….
Class Name ->Stud_Name Package Name -> p1
7. Click on finish.
34
8. Right click on project name and create JSF Pages from Entity Classes.
9. Select and click on Add button and then Next button on below
35
10. A window like below will appear on the screen. Enter the data into that window as entered in
below pic and click on Next button.
36
11. Now click on Finish.
12. Right click on project name and create RESTful Web Services from Entity Classes.
37
13. Repeat step 9 and then it will go on next page. Then enter the p1.service in Resource Package
and then click on Finish button.
38
14. Now open Stud_Name.java file under p1 package.
15. In this file at line number 24, do the right click and select Insert Code.
16. A new list will appear. Click on Add Property
17. A new window will open. Enter name as studName. Make sure name should be exact same as of
mine and then click on OK button. Actually we are setting getter and setter method for studName.
39
18. Now right click on web application name and Deploy it.
40
41
Practical-4
1. First of all we need to create an Java Web Application with any name, let it be GoogleMap here using
Netbeans IDE.
42
3. The following code is inserted in that Input.jsp page
<form action="index.jsp">
<pre>
Enter latitude:<input type="text"
name="t1" /> Enter longitude:<input
type="text" name="t2" />
<input type="submit" value="Show" />
</pre>
</form>
4. Before running the application we need the Google API key. The steps are shown here: - Visit Google
APIs Console (https://console.developers.google.com, you have to login with your Google account).
43
5. Enable the Google Maps API V3
44
44
<script async defer
src="put your key here">
</script>
</body>
</html>
Index. Jsp
To run application :
45
Output :
46
Practical-5
Installation Steps :
47
Step 2 : #sudo apt-get install qemu-kvm libvirt-bin bridge-utils virt-manager
48
Step 5 : Open Virtual Machine Manager application and Create Virtual Machine
#virt-manager as shown below
49
Step 7 : Install windows operating system on virtual machine
50
Step 9: Installation of windows 7 on virtual machine
51
Practical-6
MTOMClient Index.jsp
<%@page import="java.io.BufferedOutputStream">
<%@page import="java.io.FileOutputStream">
<%@page import="java.io.FileInputStream">
<%@page import="java.io.BufferedInputStream">
<%@page import="javax.imageio.stream.FileImageInputStream">
<%@page import="java.io.File">
<%@page import="javax.xml.ws.soap.MTOMFeature">
<%@page contentType="text/html" pageEncoding="UTF-8">
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
52
<%-- start web service invocation --><hr/>
<%
try {
MTOMServer
ImageWS.java
package mypkg;
import java.io.*;
import javax.jws.Oneway;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.xml.ws.soap.MTOM;
@MTOM(enabled=true,threshold=60000)
@WebService(serviceName = "ImageWS") public class ImageWS { @WebMethod(operationName = "upload")
@Oneway
public void upload(@WebParam(name = "Filename") String Filename, @WebParam(name = "ImageBytes") byte[]
ImageBytes){
String filePath="C:/MSC/upload/"+Filename; try
{
FileOutputStream fos=new FileOutputStream(filePath); BufferedOutputStream bos=new BufferedOutputStream(fos);
bos.write(ImageBytes);
bos.close();
System.out.println("Recieved file :"+filePath);
}
catch(Exception ex)
{
System.out.println(ex);
53
}
}
@WebMethod(operationName = "download")
public byte[] download(@WebParam(name = "Filename")
String Filename) { String
filePath="C:/MSC/upload/"+Filename;
System.out.println("Sendi
ng file :"+filePath); try
{
File file=new File(filePath);
FileInputStream fis=new
FileInputStream(file);
BufferedInputStream bis=new
BufferedInputStream(fis); byte[]
fileBytes=new byte[(int)file.length()];
bis.read(fileBytes);
bis.close(); return fileBytes;
}
catch(Exception ex)
{
System.out.println(ex);
}
return null;
}
}
54
Practical-7
Steps:
1. Open terminal and enter the following Command ‘’sudo apt upgrade” and “sudo apt update”
4. Once the virt manager is launched click on file➔ new virtual machine
55
Select local install media (ISO image or CDROM) and click Forward
56
Uncheck The checkbox and Choose the OS you are installing as “Generic default” and click“Forward”
5. Provide the Memory, CPU,Storage,Name For Virtual Machine and click “Forward”
6. Once the foss Cloud is launched select “Foss-Cloud installer :default boot options” and press Enter
Step 1: Open Terminal and Update and Upgrade your system by command
Step 9: Type “N” if it ask to use most popular runtime and package type
Open new terminal by pressing ctrl+shift+T and check for python version by command
python –version
Select the option according to your python version in my case its option 19- python 3.11
Step 10: Select package type as Zip
After entering the project folder we will invoke the HelloWorldFunction by using commandsam
local invoke „HelloWorldFunction‟
Step 13: Type command sam local start-api this will give you URL open it in any browser.
Output:
Practical-10
Steps:
Step 1: Update and Upgrade the System
To start off, log into your Ubuntu 18.04 system using SSH protocol and update &
upgra system repositories using the following command.
Sample Output
Once you have successfully created the user ‘stack’ and assigned sudo privileges, swit the user
su - stack
In most Ubuntu 18.04 systems, git comes already installed. If by any chance git is miss install it by
running the following command.
Sample output
acdlocal.conf
devstackconfiguration file.
vim local.conf
Paste the following content
[[local|localrc]]
To commence the installation of OpenStack on Ubuntu 18.04, run the script below cont in
devstack directory.
./stack.sh
The deployment takes about 10 to 15 minutes depending on the speed of your system internet
connection. In our case, it took roughly 12 minutes. At the very end, you shoul output similar to
what we have below.
This confirms that all went well and that we can proceed to access OpenStack via a we browser.
Enter the credentials and hit “Sign In” You should be able to see the Management console
dashboard as shown below.