CC Final Practs - Merged
CC Final Practs - Merged
KALYAN
CERTIFICATE
This is to certify that Mr./Ms.____________________________________________Exam Seat
No__________________ has satisfactorily completed the Journal on
_________________________________________________for partial fulfillment of the 3
year Full Time Course Bachelor of Computer Science (SEM-VI) of the University of Mumbai
forthe year 2023-2024.
Practical-1
Create a Simple SOAP service.
Steps:
1] Open the NetBeans , and you will get the following screen. Close the start page.
2] Now click on the file tab and click on new project you will get the following screen :
TYCS SEM-VI Cloud Computing and Web Services Journal
3] In Categories select Java Web and in Projects , Select Web Application .After selecting click onnext .
You will get the following window:
4] Now Give name to the Project Name: , and click on next . you will get the following windowthen
. again click on finish:
TYCS SEM-VI Cloud Computing and Web Services Journal
5] You will get the following screen now carefully see in projects section your recently created project
appears double click to expand it:
6] Now Right click on the project and select new and then select Web Service ,As shown Below:
TYCS SEM-VI Cloud Computing and Web Services Journal
7] after clicking Web Service following window should appear , now give name to web serviceand
give package as “server”. As shown in the image:
After clicking finish you should get the following window erase the mentioned code :
8] Now right click any where and click on insert code and select Add Web Service Operation :
9] the following window would appear :
Just give name to the method or operation and click on add button to add parameters to the method as
here we are converting dollar to rupees we should need only one parameter .
10] give the name to the variable select data type as double and click on ok as shown below:
11] After clicking ok code will autogenerate , make changes In that code as mentioned below:
12] now our web service is ready now right click on project and click on deploy :
13] now right click on webservice and click on test web service you will get the following output:
https://study.cscornersunitarai.com/ https://www.youtube.com/@cscornersunitarai
14] now our web service is successfully deployed. Right click on web pages and select new and
select jsp as shown below:
15] give name and click on finish as shown below do it 2 times on for input and one foroutput:
16] In input.jsp create a form for taking user input as shown below:
In this code set action = the jsp file where u want output and give name to textbox input.
17] now we have to create web service client, for same right click on project and select new then
select web service client you will get the following screen:
At this step click on browse and select your project and click ok after clicking ok you will get wsdl url as
shown below:
At this stage copy the url and paste it in notepad for future.
Give package name as “Client”.
18] now in project section you can se a new folder is been created named “web servicerefrence”.
double click to expand it you should get the following :
Hold the operation or your operation name and drag it into the output.jsp in body tag as shown
: You will get the following auto generated code:
20] now Deploy our project again and right click on input.jsp and click run file you will redirect to a
browser page as shown :
Enter any numerical value in text box and click on submit you will get the following output:
Python client:
1] for consuming java web services in python we should repeat the above steps till step np.19 .
Note: for getting output the project or web service should be deployed .
After doing all of the steps write the following code in python idle:
Code :
In step no.17 . and replace the InrtoDollarwith your method or operation name. and pass parameter
to it
4] after running the above code you should get the following output:
.Net Client
1] open visual studio and select create a new project the following window will appear:
Here in search bar type “console c#” and select console app for .Net frame work as shown in
above image.
2] Give name to the project and press create button as shown in the image:
This window should appear after clicking create button now In right side there is solution Explorer.
In that right click on your project name and click on add > Service Reference . You will get the
following window :
Note: before executing the code make sure that the web service is deployed.
Here in address bar paste the wsdl url the same which is used I python code. And press go button . agter
set the namespace In my case I am letting is as it is then press ok button.
In following image u can check in solution Explorer service refrence iscreated.:
3] now in code write the following line as shown in image:
Here type:
Using your_projectname . your_serviceReference_name ;
Here CurrencyClient is my webservice class name and operation() is my method name as show
you can also check your own:
5] when you run the above code you get the following output:
Practical-2
Open netbeans
Take new project-----java web(left)----new application(right)
Practical-3A
Demonstrate CRUD operations with suitable database using RESTful Web service.
1. To start the Java DB Database from NetBeans, perform the following steps.
Click Services tab -> Expand Databases node. ->Right-click Java DB icon.
Database Name:
playerDBUser Name:
john Password: john
Confirm Password:john
c. Click OK.
3. To connect to the newly created database playerDB, perform the following steps
b. Select Connect.
Player server
To create RESTful Web Services, you need a Java Web application project. In the below section you
willcreate a demo Java web project, PlayerServer.
To create new Java Web Project, select File -> New Project -> Java web -> Web Application.
Generating web service
To generate RESTful Web Services do the following:
1.Right-click the PlayerServer and choose New > Other > Web Services > RESTful Web Services from
Database. The New RESTful Web Service wizard opens on the Database Tables panel.
2. In the Database Tables window, select Data Source.
The PLAYER and TEAM tables are displayed under the Available Tables column.
c. Click Add All. The PLAYER and TEAM tables are displayed under the Selected Tables column.
d. Click Next.
1. Right-click PlayerClient Project and select New > Entity Classes From Database.
3. In the Entity classes Window, enter the Package Name as playerentities and click Next.
Create Client
Complete the following steps to create RESTful client in PlayerClient project.
a. Right-click the PlayerClient and choose New > Other > Web Services > RESTful Java Client.
b. Click Next.
1. a.Enter the following details for the fields in the New Restful Java Client window :
Class Name: CreatePlayerJerseyClient
Package: playerClient
Select the REST resource: From Project and Click Browse.
b. Select PlayerServer.
c. Expand the PlayerServer application.
d. Select PlayerFacadeREST[com.playerentity.player].
2.Add the main method.
public static void main(String[]args){
CreateClient client1 = new CreateClient();
ClientResponse response = client1.findAll_XML(ClientResponse.class);
Read Client
public static void main(String[]args){
ReadClient client1 = new ReadClient();
ClientResponse response = client1.findAll_XML(ClientResponse.class);
GenericType<List<Player>> genericType = new GenericType<List<Player>>(){};
List<Player> data = new ArrayList<Player>();
data = (response.getEntity(genericType));
System.out.println("Retreiving and Displaying Player Details");
for(Player players:data){
System.out.println("FirstName:"+players.getFirstname());
System.out.println("PlayerID:"+players.getId());
System.out.println("JerseyNo:"+players.getJerseynumber());
}
System.out.println("Data Retreived!!");
}
Delete Client
public static void main(String[]args){
DeleteClient client1 = new DeleteClient();
client1.remove("1");
}
Update Client
public static void main(String[]args){
UpdateClient client1 = new UpdateClient();
ClientResponse response = client1.find_XML(ClientResponse.class, "2");
GenericType<Player>genericType = new GenericType<Player>(){};
Player player = response.getEntity(genericType);
System.out.println("First Name: "+player.getFirstname());
System.out.println("PlayerId: "+player.getId());
System.out.println("JerseyNo: "+player.getJerseynumber());
System.out.println("Last Name: "+player.getLastname());
System.out.println("Last Spoken Words: "+player.getLastspokenwords());
player.setJerseynumber(100);
player.setLastspokenwords("I will be retiring soon");
client1.edit_XML(player);
}
Practical No. 3B
Blogger Client
Create Client
public static void main(String[]args){
CreateClient client1 = new CreateClient();
ClientResponse response = client1.findAll_XML(ClientResponse.class);
GenericType<List<Bloggerdb>> genericType = new GenericType<List<Bloggerdb>>(){};
List<Bloggerdb> data = new ArrayList<Bloggerdb>();
data = (response.getEntity(genericType));
Bloggerdb b = new Bloggerdb();
b.setMessageId(4);
b.setContent("Draco the Slytherine Champion");
b.setUsername("Draco");
b.setPassword("Malfoy");
client1.create_XML(b);
}
Update Client
public static void main(String[]args){
UpdateClient client1 = new UpdateClient();
ClientResponse response = client1.find_XML(ClientResponse.class, "1");
GenericType<Bloggerdb>genericType = new GenericType<Bloggerdb>(){};
Bloggerdb b = response.getEntity(genericType);
System.out.println("Message id:"+b.getMessageId());
System.out.println("Content:"+b.getContent());
System.out.println("Username:"+b.getUsername());
System.out.println("Password:"+b.getPassword());
b.setContent("I love food");
client1.edit_XML(b);
}
Delete Client
public static void main(String[]args){
DeleteClient client1 = new DeleteClient();
client1.remove("4");
System.out.println("Successfully Deleted!!");
}
Read Client
public static void main(String[]args){
ReadClient client1 = new ReadClient();
ClientResponse response = client1.findAll_XML(ClientResponse.class);
GenericType<List<Bloggerdb>> genericType = new GenericType<List<Bloggerdb>>(){};
List<Bloggerdb> data = new ArrayList<Bloggerdb>();
data = (response.getEntity(genericType));
System.out.println("Retreiving and Displaying Player Details");
for(Bloggerdb b:data){
System.out.println("Content: "+b.getContent());
System.out.println("Username: "+b.getUsername());
System.out.println("Password:"+b.getPassword());
}
System.out.println("Data Retreived!!");
}
Practical-4
Develop application to consume Google’s search / Google’s Map RESTful Web service.
import requests
if result:
print("Output:")
for key, value in result.items():
print(f"{key}: {value}")
BROWSE LOCATION IQ>SIGNUP WITH EMAIL> CLICK ON THE LINK PROVIDED BY LOCATION IQ (on
your email)>YOU WILL GET YOUR ACCESS TOKEN COPY THE KEY AND PASTE IN THE PYTHON CODE:
Sudoadduser shraddha
Sudoadduser shraddha libvirtd
Virt-manager
Click on new virtual machine in qemu and perform the following step
After that you will get final output
Practical-6
Develop application to download image/video from server or upload image/videoto server using MTOM techniques
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>
<%-- start web service invocation --><hr/>
<%
try {
pkg.ImageWS_Service service = new pkg.ImageWS_Service();
pkg.ImageWS port = service.getImageWSPort(new MTOMFeature(60000));
// TODO initialize WS operation arguments here
String filePath="c:/msc/ABC.jpg";
File file=new File(filePath);
FileInputStream fis=new FileInputStream(file);
BufferedInputStream bis=new BufferedInputStream(fis);
java.lang.String filename = file.getName();
byte[]imageBytes=new byte[(int)file.length()];
bis.read(imageBytes);
port.upload(filename, imageBytes);
bis.close();
out.println("File uploaded :"+filePath);
} catch (Exception ex) {
// TODO handle custom exceptions here
}
>
<%-- end web service invocation --><hr/>
{
System.out.println(ex);
}
}
@WebMethod(operationName = "download")
public byte[] download(@WebParam(name = "Filename") String Filename) {
String filePath="C:/MSC/upload/"+Filename;
System.out.println("Sending 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;
}
}
Output:
Practical-07
Aim: Develop client which consumes web services developed in different platform.
Create a webservice in netbean and use it in .NET
Open Netbeans 8.2 – file—new- progect
Right Click on FactorialWebService project->New->Web Service
double f=1;
int i;
for(i=1;i<=num;i++){
f= f*i;
return f;
}
Right click on project name FactorialWebService->clean and build
Right click on project name FactorialWebService ->deploy
Right click on FactorialWebService ---test web service
http://localhost:14188/FactorialWebservice/Factorialwebservice?WSDL
4:- clean and build , and deploy the webservice created in the java and Test the WebService
http://localhost:14188/FactorialWebservice/Factorialwebservice?WSDL
5:- Now RightClick on Progect name and add (Service Reference in Client app) and paste the WSDL url
6:- Now doubleclick the button and then type the following cod in the aspx.cs file
ServiceReference1.FactorialwebserviceClient client =
new ServiceReference1.FactorialwebserviceClient();
output:-
Practical-08
Implement FOSS-Cloud Functionality VSI (Virtual Server Infrastructure) Infrastructure as a Service (IaaS),
Creating Virtual Machine or Storage
Steps:
3. Choose Demo-System: 1
Note :- Above mentioned steps aren’t mandatory you can start with the installation process of
virt-viewer as shown below.
1. Install virt-viewer.
2. Install spice-client.0.6.3.
3. Open Browser.
Now choose the ubuntu-16.04.5-desktop-i386 iso-file from the FOSS cloud folder. Then, give
your desired file name to it and click on the upload button.
Once done with the upload process go to the create section in profiles.
Creating a Profile
The profile creates the relationship between the ISO file and the FOSS-Cloud.
1. Open Virtual Machines
2. Choose VM-Profiles
3. Choose the right Base Profile
4. Choose the right architecture (Windows only x86_64)
5. Chose the language (it is a information - not keyboard relevant)
6. Choose the ISO file (which you gave in file name tab)
7. Fill out name and description
8. Choose the amount of memory and volume capacity
9. Choose amount of CPU
10. Choose clock offset (normally Windows is "localtime" and Linux is "utc")
Now, we will create a VM template.
Creating Template
1. Choose the profile you have prepared before.
2. Add the VM-pool and one or more nodes, where you will run this VM (when the chosen VM-
pool has only one node assigned, you don't have a choice)
3. You can change all the other information you have entered before
Click on "create" and the template is ready for installing the guest operating system.
Once you create your virtual machine template you will be able to see your VM template.
As you can see the last row of Display column our template is created.
Just after clicking on, it a pop up would appear to Open remote-viewer? click on Open-remote-
viewer button, you will see the following screen.
Note :- If you don't see the above screen follow the below given steps.
1.First press window + r, then type regedit and click ok.
2. Further permissions tab will open then click yes, and a regedit editor will get open.
3. In the Registry Editor a list of directories would appear, in those lists of directories search
for the spice directory.
4. Keep on expanding the spice directory until you reach the command section.
5. Then click on the default file and a pop up will appear, then you have to paste the path
C:\Users\ADMIN\AppData\Local\virt-viewer\bin in the value data and also type %1 in last.
Once done the above screen will appear.
Finally, after clicking on remote viewer button a command line come where a graphical control
loading and getting connected will be displayed and then finally the ubuntu will get open.
On opening of ubuntu click on try ubuntu. Now, you can use ubuntu on your virtual machine.
Practical-09
Software development Kits can be made available in the Virtual Machines that can be implemented
as Platform as a Service.
Installationof Netbeans, Eclipse, Visual Studio and DBMS can be done in the appropriate Virtual
Aim: Implement FOSS-Cloud Functionality VSI Software as a Service (SaaS)
Applications created and deployed in the virtual machines can be accessed by outside world.
Open Netbeans 8/8.2 --- file --- new project --- java web (left) --- web application(right)
package mypack;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;
@WebService(serviceName = "tempservice")
@WebMethod(operationName = "hello")
@WebMethod(operationName = "F_to_C")
return ((val-32)*5/9);
@WebMethod(operationName = "C_to_F")
Step 4 run
URL http://localhost:8080/tempwebservice/tempWebService?WSDL
//TempClient.java
package tempclient;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
Double t;
int ch;
ch=Integer.parseInt(br.readLine());
System.out.println("Enter temperature");
t=Double.parseDouble(br.readLine());
if(ch==1)
System.out.println("temperature in fahrenheit="+cToF(t));
else
System.out.println("Temperature in celcius="+fToC(t));
return port.cToF(val);
return port.fToC(val);
O/P:
1. Celcius to Fahreheit
2. Fahrenheit to celcius
Enter your Choice
1
Enter temperature
25
temperature in fahrenheit=77.0
K.M.AGRAWAL COLLEGE OF ARTS, COMMERCE
AND SCIENCE
KALYAN
CERTIFICATE
This is to certify that Mr./Ms.____________________________________________Exam Seat
No__________________ has satisfactorily completed the Journal on
_________________________________________________for partial fulfillment of the 3
year Full Time Course Bachelor of Computer Science (SEM-VI) of the University of Mumbai
forthe year 2023-2024.
Practical-1
Create a Simple SOAP service.
Steps:
1] Open the NetBeans , and you will get the following screen. Close the start page.
2] Now click on the file tab and click on new project you will get the following screen :
TYCS SEM-VI Cloud Computing and Web Services Journal
3] In Categories select Java Web and in Projects , Select Web Application .After selecting click onnext .
You will get the following window:
4] Now Give name to the Project Name: , and click on next . you will get the following windowthen
. again click on finish:
TYCS SEM-VI Cloud Computing and Web Services Journal
5] You will get the following screen now carefully see in projects section your recently created project
appears double click to expand it:
6] Now Right click on the project and select new and then select Web Service ,As shown Below:
TYCS SEM-VI Cloud Computing and Web Services Journal
7] after clicking Web Service following window should appear , now give name to web serviceand
give package as “server”. As shown in the image:
After clicking finish you should get the following window erase the mentioned code :
8] Now right click any where and click on insert code and select Add Web Service Operation :
9] the following window would appear :
Just give name to the method or operation and click on add button to add parameters to the method as
here we are converting dollar to rupees we should need only one parameter .
10] give the name to the variable select data type as double and click on ok as shown below:
11] After clicking ok code will autogenerate , make changes In that code as mentioned below:
12] now our web service is ready now right click on project and click on deploy :
13] now right click on webservice and click on test web service you will get the following output:
https://study.cscornersunitarai.com/ https://www.youtube.com/@cscornersunitarai
14] now our web service is successfully deployed. Right click on web pages and select new and
select jsp as shown below:
15] give name and click on finish as shown below do it 2 times on for input and one foroutput:
16] In input.jsp create a form for taking user input as shown below:
In this code set action = the jsp file where u want output and give name to textbox input.
17] now we have to create web service client, for same right click on project and select new then
select web service client you will get the following screen:
At this step click on browse and select your project and click ok after clicking ok you will get wsdl url as
shown below:
At this stage copy the url and paste it in notepad for future.
Give package name as “Client”.
18] now in project section you can se a new folder is been created named “web servicerefrence”.
double click to expand it you should get the following :
Hold the operation or your operation name and drag it into the output.jsp in body tag as shown
: You will get the following auto generated code:
20] now Deploy our project again and right click on input.jsp and click run file you will redirect to a
browser page as shown :
Enter any numerical value in text box and click on submit you will get the following output:
Python client:
1] for consuming java web services in python we should repeat the above steps till step np.19 .
Note: for getting output the project or web service should be deployed .
After doing all of the steps write the following code in python idle:
Code :
In step no.17 . and replace the InrtoDollarwith your method or operation name. and pass parameter
to it
4] after running the above code you should get the following output:
.Net Client
1] open visual studio and select create a new project the following window will appear:
Here in search bar type “console c#” and select console app for .Net frame work as shown in
above image.
2] Give name to the project and press create button as shown in the image:
This window should appear after clicking create button now In right side there is solution Explorer.
In that right click on your project name and click on add > Service Reference . You will get the
following window :
Note: before executing the code make sure that the web service is deployed.
Here in address bar paste the wsdl url the same which is used I python code. And press go button . agter
set the namespace In my case I am letting is as it is then press ok button.
In following image u can check in solution Explorer service refrence iscreated.:
3] now in code write the following line as shown in image:
Here type:
Using your_projectname . your_serviceReference_name ;
Here CurrencyClient is my webservice class name and operation() is my method name as show
you can also check your own:
5] when you run the above code you get the following output:
Practical-2
Open netbeans
Take new project-----java web(left)----new application(right)
Practical-3A
Demonstrate CRUD operations with suitable database using RESTful Web service.
1. To start the Java DB Database from NetBeans, perform the following steps.
Click Services tab -> Expand Databases node. ->Right-click Java DB icon.
Database Name:
playerDBUser Name:
john Password: john
Confirm Password:john
c. Click OK.
3. To connect to the newly created database playerDB, perform the following steps
b. Select Connect.
Player server
To create RESTful Web Services, you need a Java Web application project. In the below section you
willcreate a demo Java web project, PlayerServer.
To create new Java Web Project, select File -> New Project -> Java web -> Web Application.
Generating web service
To generate RESTful Web Services do the following:
1.Right-click the PlayerServer and choose New > Other > Web Services > RESTful Web Services from
Database. The New RESTful Web Service wizard opens on the Database Tables panel.
2. In the Database Tables window, select Data Source.
The PLAYER and TEAM tables are displayed under the Available Tables column.
c. Click Add All. The PLAYER and TEAM tables are displayed under the Selected Tables column.
d. Click Next.
1. Right-click PlayerClient Project and select New > Entity Classes From Database.
3. In the Entity classes Window, enter the Package Name as playerentities and click Next.
Create Client
Complete the following steps to create RESTful client in PlayerClient project.
a. Right-click the PlayerClient and choose New > Other > Web Services > RESTful Java Client.
b. Click Next.
1. a.Enter the following details for the fields in the New Restful Java Client window :
Class Name: CreatePlayerJerseyClient
Package: playerClient
Select the REST resource: From Project and Click Browse.
b. Select PlayerServer.
c. Expand the PlayerServer application.
d. Select PlayerFacadeREST[com.playerentity.player].
2.Add the main method.
public static void main(String[]args){
CreateClient client1 = new CreateClient();
ClientResponse response = client1.findAll_XML(ClientResponse.class);
Read Client
public static void main(String[]args){
ReadClient client1 = new ReadClient();
ClientResponse response = client1.findAll_XML(ClientResponse.class);
GenericType<List<Player>> genericType = new GenericType<List<Player>>(){};
List<Player> data = new ArrayList<Player>();
data = (response.getEntity(genericType));
System.out.println("Retreiving and Displaying Player Details");
for(Player players:data){
System.out.println("FirstName:"+players.getFirstname());
System.out.println("PlayerID:"+players.getId());
System.out.println("JerseyNo:"+players.getJerseynumber());
}
System.out.println("Data Retreived!!");
}
Delete Client
public static void main(String[]args){
DeleteClient client1 = new DeleteClient();
client1.remove("1");
}
Update Client
public static void main(String[]args){
UpdateClient client1 = new UpdateClient();
ClientResponse response = client1.find_XML(ClientResponse.class, "2");
GenericType<Player>genericType = new GenericType<Player>(){};
Player player = response.getEntity(genericType);
System.out.println("First Name: "+player.getFirstname());
System.out.println("PlayerId: "+player.getId());
System.out.println("JerseyNo: "+player.getJerseynumber());
System.out.println("Last Name: "+player.getLastname());
System.out.println("Last Spoken Words: "+player.getLastspokenwords());
player.setJerseynumber(100);
player.setLastspokenwords("I will be retiring soon");
client1.edit_XML(player);
}
Practical No. 3B
Blogger Client
Create Client
public static void main(String[]args){
CreateClient client1 = new CreateClient();
ClientResponse response = client1.findAll_XML(ClientResponse.class);
GenericType<List<Bloggerdb>> genericType = new GenericType<List<Bloggerdb>>(){};
List<Bloggerdb> data = new ArrayList<Bloggerdb>();
data = (response.getEntity(genericType));
Bloggerdb b = new Bloggerdb();
b.setMessageId(4);
b.setContent("Draco the Slytherine Champion");
b.setUsername("Draco");
b.setPassword("Malfoy");
client1.create_XML(b);
}
Update Client
public static void main(String[]args){
UpdateClient client1 = new UpdateClient();
ClientResponse response = client1.find_XML(ClientResponse.class, "1");
GenericType<Bloggerdb>genericType = new GenericType<Bloggerdb>(){};
Bloggerdb b = response.getEntity(genericType);
System.out.println("Message id:"+b.getMessageId());
System.out.println("Content:"+b.getContent());
System.out.println("Username:"+b.getUsername());
System.out.println("Password:"+b.getPassword());
b.setContent("I love food");
client1.edit_XML(b);
}
Delete Client
public static void main(String[]args){
DeleteClient client1 = new DeleteClient();
client1.remove("4");
System.out.println("Successfully Deleted!!");
}
Read Client
public static void main(String[]args){
ReadClient client1 = new ReadClient();
ClientResponse response = client1.findAll_XML(ClientResponse.class);
GenericType<List<Bloggerdb>> genericType = new GenericType<List<Bloggerdb>>(){};
List<Bloggerdb> data = new ArrayList<Bloggerdb>();
data = (response.getEntity(genericType));
System.out.println("Retreiving and Displaying Player Details");
for(Bloggerdb b:data){
System.out.println("Content: "+b.getContent());
System.out.println("Username: "+b.getUsername());
System.out.println("Password:"+b.getPassword());
}
System.out.println("Data Retreived!!");
}
Practical-4
Develop application to consume Google’s search / Google’s Map RESTful Web service.
import requests
if result:
print("Output:")
for key, value in result.items():
print(f"{key}: {value}")
BROWSE LOCATION IQ>SIGNUP WITH EMAIL> CLICK ON THE LINK PROVIDED BY LOCATION IQ (on
your email)>YOU WILL GET YOUR ACCESS TOKEN COPY THE KEY AND PASTE IN THE PYTHON CODE:
Sudoadduser shraddha
Sudoadduser shraddha libvirtd
Virt-manager
Click on new virtual machine in qemu and perform the following step
After that you will get final output
Practical-6
Develop application to download image/video from server or upload image/videoto server using MTOM techniques
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>
<%-- start web service invocation --><hr/>
<%
try {
pkg.ImageWS_Service service = new pkg.ImageWS_Service();
pkg.ImageWS port = service.getImageWSPort(new MTOMFeature(60000));
// TODO initialize WS operation arguments here
String filePath="c:/msc/ABC.jpg";
File file=new File(filePath);
FileInputStream fis=new FileInputStream(file);
BufferedInputStream bis=new BufferedInputStream(fis);
java.lang.String filename = file.getName();
byte[]imageBytes=new byte[(int)file.length()];
bis.read(imageBytes);
port.upload(filename, imageBytes);
bis.close();
out.println("File uploaded :"+filePath);
} catch (Exception ex) {
// TODO handle custom exceptions here
}
>
<%-- end web service invocation --><hr/>
{
System.out.println(ex);
}
}
@WebMethod(operationName = "download")
public byte[] download(@WebParam(name = "Filename") String Filename) {
String filePath="C:/MSC/upload/"+Filename;
System.out.println("Sending 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;
}
}
Output:
Practical-07
Aim: Develop client which consumes web services developed in different platform.
Create a webservice in netbean and use it in .NET
Open Netbeans 8.2 – file—new- progect
Right Click on FactorialWebService project->New->Web Service
double f=1;
int i;
for(i=1;i<=num;i++){
f= f*i;
return f;
}
Right click on project name FactorialWebService->clean and build
Right click on project name FactorialWebService ->deploy
Right click on FactorialWebService ---test web service
http://localhost:14188/FactorialWebservice/Factorialwebservice?WSDL
4:- clean and build , and deploy the webservice created in the java and Test the WebService
http://localhost:14188/FactorialWebservice/Factorialwebservice?WSDL
5:- Now RightClick on Progect name and add (Service Reference in Client app) and paste the WSDL url
6:- Now doubleclick the button and then type the following cod in the aspx.cs file
ServiceReference1.FactorialwebserviceClient client =
new ServiceReference1.FactorialwebserviceClient();
output:-
Practical-08
Implement FOSS-Cloud Functionality VSI (Virtual Server Infrastructure) Infrastructure as a Service (IaaS),
Creating Virtual Machine or Storage
Steps:
3. Choose Demo-System: 1
Note :- Above mentioned steps aren’t mandatory you can start with the installation process of
virt-viewer as shown below.
1. Install virt-viewer.
2. Install spice-client.0.6.3.
3. Open Browser.
Now choose the ubuntu-16.04.5-desktop-i386 iso-file from the FOSS cloud folder. Then, give
your desired file name to it and click on the upload button.
Once done with the upload process go to the create section in profiles.
Creating a Profile
The profile creates the relationship between the ISO file and the FOSS-Cloud.
1. Open Virtual Machines
2. Choose VM-Profiles
3. Choose the right Base Profile
4. Choose the right architecture (Windows only x86_64)
5. Chose the language (it is a information - not keyboard relevant)
6. Choose the ISO file (which you gave in file name tab)
7. Fill out name and description
8. Choose the amount of memory and volume capacity
9. Choose amount of CPU
10. Choose clock offset (normally Windows is "localtime" and Linux is "utc")
Now, we will create a VM template.
Creating Template
1. Choose the profile you have prepared before.
2. Add the VM-pool and one or more nodes, where you will run this VM (when the chosen VM-
pool has only one node assigned, you don't have a choice)
3. You can change all the other information you have entered before
Click on "create" and the template is ready for installing the guest operating system.
Once you create your virtual machine template you will be able to see your VM template.
As you can see the last row of Display column our template is created.
Just after clicking on, it a pop up would appear to Open remote-viewer? click on Open-remote-
viewer button, you will see the following screen.
Note :- If you don't see the above screen follow the below given steps.
1.First press window + r, then type regedit and click ok.
2. Further permissions tab will open then click yes, and a regedit editor will get open.
3. In the Registry Editor a list of directories would appear, in those lists of directories search
for the spice directory.
4. Keep on expanding the spice directory until you reach the command section.
5. Then click on the default file and a pop up will appear, then you have to paste the path
C:\Users\ADMIN\AppData\Local\virt-viewer\bin in the value data and also type %1 in last.
Once done the above screen will appear.
Finally, after clicking on remote viewer button a command line come where a graphical control
loading and getting connected will be displayed and then finally the ubuntu will get open.
On opening of ubuntu click on try ubuntu. Now, you can use ubuntu on your virtual machine.
Practical-09
Software development Kits can be made available in the Virtual Machines that can be implemented
as Platform as a Service.
Installationof Netbeans, Eclipse, Visual Studio and DBMS can be done in the appropriate Virtual
Aim: Implement FOSS-Cloud Functionality VSI Software as a Service (SaaS)
Applications created and deployed in the virtual machines can be accessed by outside world.
Open Netbeans 8/8.2 --- file --- new project --- java web (left) --- web application(right)
package mypack;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;
@WebService(serviceName = "tempservice")
@WebMethod(operationName = "hello")
@WebMethod(operationName = "F_to_C")
return ((val-32)*5/9);
@WebMethod(operationName = "C_to_F")
Step 4 run
URL http://localhost:8080/tempwebservice/tempWebService?WSDL
//TempClient.java
package tempclient;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
Double t;
int ch;
ch=Integer.parseInt(br.readLine());
System.out.println("Enter temperature");
t=Double.parseDouble(br.readLine());
if(ch==1)
System.out.println("temperature in fahrenheit="+cToF(t));
else
System.out.println("Temperature in celcius="+fToC(t));
return port.cToF(val);
return port.fToC(val);
O/P:
1. Celcius to Fahreheit
2. Fahrenheit to celcius
Enter your Choice
1
Enter temperature
25
temperature in fahrenheit=77.0
K.M.AGRAWAL COLLEGE OF ARTS, COMMERCE
AND SCIENCE
KALYAN
CERTIFICATE
This is to certify that Mr./Ms.____________________________________________Exam Seat
No__________________ has satisfactorily completed the Journal on
_________________________________________________for partial fulfillment of the 3
year Full Time Course Bachelor of Computer Science (SEM-VI) of the University of Mumbai
forthe year 2023-2024.
Practical-1
Create a Simple SOAP service.
Steps:
1] Open the NetBeans , and you will get the following screen. Close the start page.
2] Now click on the file tab and click on new project you will get the following screen :
TYCS SEM-VI Cloud Computing and Web Services Journal
3] In Categories select Java Web and in Projects , Select Web Application .After selecting click onnext .
You will get the following window:
4] Now Give name to the Project Name: , and click on next . you will get the following windowthen
. again click on finish:
TYCS SEM-VI Cloud Computing and Web Services Journal
5] You will get the following screen now carefully see in projects section your recently created project
appears double click to expand it:
6] Now Right click on the project and select new and then select Web Service ,As shown Below:
TYCS SEM-VI Cloud Computing and Web Services Journal
7] after clicking Web Service following window should appear , now give name to web serviceand
give package as “server”. As shown in the image:
After clicking finish you should get the following window erase the mentioned code :
8] Now right click any where and click on insert code and select Add Web Service Operation :
9] the following window would appear :
Just give name to the method or operation and click on add button to add parameters to the method as
here we are converting dollar to rupees we should need only one parameter .
10] give the name to the variable select data type as double and click on ok as shown below:
11] After clicking ok code will autogenerate , make changes In that code as mentioned below:
12] now our web service is ready now right click on project and click on deploy :
13] now right click on webservice and click on test web service you will get the following output:
https://study.cscornersunitarai.com/ https://www.youtube.com/@cscornersunitarai
14] now our web service is successfully deployed. Right click on web pages and select new and
select jsp as shown below:
15] give name and click on finish as shown below do it 2 times on for input and one foroutput:
16] In input.jsp create a form for taking user input as shown below:
In this code set action = the jsp file where u want output and give name to textbox input.
17] now we have to create web service client, for same right click on project and select new then
select web service client you will get the following screen:
At this step click on browse and select your project and click ok after clicking ok you will get wsdl url as
shown below:
At this stage copy the url and paste it in notepad for future.
Give package name as “Client”.
18] now in project section you can se a new folder is been created named “web servicerefrence”.
double click to expand it you should get the following :
Hold the operation or your operation name and drag it into the output.jsp in body tag as shown
: You will get the following auto generated code:
20] now Deploy our project again and right click on input.jsp and click run file you will redirect to a
browser page as shown :
Enter any numerical value in text box and click on submit you will get the following output:
Python client:
1] for consuming java web services in python we should repeat the above steps till step np.19 .
Note: for getting output the project or web service should be deployed .
After doing all of the steps write the following code in python idle:
Code :
In step no.17 . and replace the InrtoDollarwith your method or operation name. and pass parameter
to it
4] after running the above code you should get the following output:
.Net Client
1] open visual studio and select create a new project the following window will appear:
Here in search bar type “console c#” and select console app for .Net frame work as shown in
above image.
2] Give name to the project and press create button as shown in the image:
This window should appear after clicking create button now In right side there is solution Explorer.
In that right click on your project name and click on add > Service Reference . You will get the
following window :
Note: before executing the code make sure that the web service is deployed.
Here in address bar paste the wsdl url the same which is used I python code. And press go button . agter
set the namespace In my case I am letting is as it is then press ok button.
In following image u can check in solution Explorer service refrence iscreated.:
3] now in code write the following line as shown in image:
Here type:
Using your_projectname . your_serviceReference_name ;
Here CurrencyClient is my webservice class name and operation() is my method name as show
you can also check your own:
5] when you run the above code you get the following output:
Practical-2
Open netbeans
Take new project-----java web(left)----new application(right)
Practical-3A
Demonstrate CRUD operations with suitable database using RESTful Web service.
1. To start the Java DB Database from NetBeans, perform the following steps.
Click Services tab -> Expand Databases node. ->Right-click Java DB icon.
Database Name:
playerDBUser Name:
john Password: john
Confirm Password:john
c. Click OK.
3. To connect to the newly created database playerDB, perform the following steps
b. Select Connect.
Player server
To create RESTful Web Services, you need a Java Web application project. In the below section you
willcreate a demo Java web project, PlayerServer.
To create new Java Web Project, select File -> New Project -> Java web -> Web Application.
Generating web service
To generate RESTful Web Services do the following:
1.Right-click the PlayerServer and choose New > Other > Web Services > RESTful Web Services from
Database. The New RESTful Web Service wizard opens on the Database Tables panel.
2. In the Database Tables window, select Data Source.
The PLAYER and TEAM tables are displayed under the Available Tables column.
c. Click Add All. The PLAYER and TEAM tables are displayed under the Selected Tables column.
d. Click Next.
1. Right-click PlayerClient Project and select New > Entity Classes From Database.
3. In the Entity classes Window, enter the Package Name as playerentities and click Next.
Create Client
Complete the following steps to create RESTful client in PlayerClient project.
a. Right-click the PlayerClient and choose New > Other > Web Services > RESTful Java Client.
b. Click Next.
1. a.Enter the following details for the fields in the New Restful Java Client window :
Class Name: CreatePlayerJerseyClient
Package: playerClient
Select the REST resource: From Project and Click Browse.
b. Select PlayerServer.
c. Expand the PlayerServer application.
d. Select PlayerFacadeREST[com.playerentity.player].
2.Add the main method.
public static void main(String[]args){
CreateClient client1 = new CreateClient();
ClientResponse response = client1.findAll_XML(ClientResponse.class);
Read Client
public static void main(String[]args){
ReadClient client1 = new ReadClient();
ClientResponse response = client1.findAll_XML(ClientResponse.class);
GenericType<List<Player>> genericType = new GenericType<List<Player>>(){};
List<Player> data = new ArrayList<Player>();
data = (response.getEntity(genericType));
System.out.println("Retreiving and Displaying Player Details");
for(Player players:data){
System.out.println("FirstName:"+players.getFirstname());
System.out.println("PlayerID:"+players.getId());
System.out.println("JerseyNo:"+players.getJerseynumber());
}
System.out.println("Data Retreived!!");
}
Delete Client
public static void main(String[]args){
DeleteClient client1 = new DeleteClient();
client1.remove("1");
}
Update Client
public static void main(String[]args){
UpdateClient client1 = new UpdateClient();
ClientResponse response = client1.find_XML(ClientResponse.class, "2");
GenericType<Player>genericType = new GenericType<Player>(){};
Player player = response.getEntity(genericType);
System.out.println("First Name: "+player.getFirstname());
System.out.println("PlayerId: "+player.getId());
System.out.println("JerseyNo: "+player.getJerseynumber());
System.out.println("Last Name: "+player.getLastname());
System.out.println("Last Spoken Words: "+player.getLastspokenwords());
player.setJerseynumber(100);
player.setLastspokenwords("I will be retiring soon");
client1.edit_XML(player);
}
Practical No. 3B
Blogger Client
Create Client
public static void main(String[]args){
CreateClient client1 = new CreateClient();
ClientResponse response = client1.findAll_XML(ClientResponse.class);
GenericType<List<Bloggerdb>> genericType = new GenericType<List<Bloggerdb>>(){};
List<Bloggerdb> data = new ArrayList<Bloggerdb>();
data = (response.getEntity(genericType));
Bloggerdb b = new Bloggerdb();
b.setMessageId(4);
b.setContent("Draco the Slytherine Champion");
b.setUsername("Draco");
b.setPassword("Malfoy");
client1.create_XML(b);
}
Update Client
public static void main(String[]args){
UpdateClient client1 = new UpdateClient();
ClientResponse response = client1.find_XML(ClientResponse.class, "1");
GenericType<Bloggerdb>genericType = new GenericType<Bloggerdb>(){};
Bloggerdb b = response.getEntity(genericType);
System.out.println("Message id:"+b.getMessageId());
System.out.println("Content:"+b.getContent());
System.out.println("Username:"+b.getUsername());
System.out.println("Password:"+b.getPassword());
b.setContent("I love food");
client1.edit_XML(b);
}
Delete Client
public static void main(String[]args){
DeleteClient client1 = new DeleteClient();
client1.remove("4");
System.out.println("Successfully Deleted!!");
}
Read Client
public static void main(String[]args){
ReadClient client1 = new ReadClient();
ClientResponse response = client1.findAll_XML(ClientResponse.class);
GenericType<List<Bloggerdb>> genericType = new GenericType<List<Bloggerdb>>(){};
List<Bloggerdb> data = new ArrayList<Bloggerdb>();
data = (response.getEntity(genericType));
System.out.println("Retreiving and Displaying Player Details");
for(Bloggerdb b:data){
System.out.println("Content: "+b.getContent());
System.out.println("Username: "+b.getUsername());
System.out.println("Password:"+b.getPassword());
}
System.out.println("Data Retreived!!");
}
Practical-4
Develop application to consume Google’s search / Google’s Map RESTful Web service.
import requests
if result:
print("Output:")
for key, value in result.items():
print(f"{key}: {value}")
BROWSE LOCATION IQ>SIGNUP WITH EMAIL> CLICK ON THE LINK PROVIDED BY LOCATION IQ (on
your email)>YOU WILL GET YOUR ACCESS TOKEN COPY THE KEY AND PASTE IN THE PYTHON CODE:
Sudoadduser shraddha
Sudoadduser shraddha libvirtd
Virt-manager
Click on new virtual machine in qemu and perform the following step
After that you will get final output
Practical-6
Develop application to download image/video from server or upload image/videoto server using MTOM techniques
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>
<%-- start web service invocation --><hr/>
<%
try {
pkg.ImageWS_Service service = new pkg.ImageWS_Service();
pkg.ImageWS port = service.getImageWSPort(new MTOMFeature(60000));
// TODO initialize WS operation arguments here
String filePath="c:/msc/ABC.jpg";
File file=new File(filePath);
FileInputStream fis=new FileInputStream(file);
BufferedInputStream bis=new BufferedInputStream(fis);
java.lang.String filename = file.getName();
byte[]imageBytes=new byte[(int)file.length()];
bis.read(imageBytes);
port.upload(filename, imageBytes);
bis.close();
out.println("File uploaded :"+filePath);
} catch (Exception ex) {
// TODO handle custom exceptions here
}
>
<%-- end web service invocation --><hr/>
{
System.out.println(ex);
}
}
@WebMethod(operationName = "download")
public byte[] download(@WebParam(name = "Filename") String Filename) {
String filePath="C:/MSC/upload/"+Filename;
System.out.println("Sending 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;
}
}
Output:
Practical-07
Aim: Develop client which consumes web services developed in different platform.
Create a webservice in netbean and use it in .NET
Open Netbeans 8.2 – file—new- progect
Right Click on FactorialWebService project->New->Web Service
double f=1;
int i;
for(i=1;i<=num;i++){
f= f*i;
return f;
}
Right click on project name FactorialWebService->clean and build
Right click on project name FactorialWebService ->deploy
Right click on FactorialWebService ---test web service
http://localhost:14188/FactorialWebservice/Factorialwebservice?WSDL
4:- clean and build , and deploy the webservice created in the java and Test the WebService
http://localhost:14188/FactorialWebservice/Factorialwebservice?WSDL
5:- Now RightClick on Progect name and add (Service Reference in Client app) and paste the WSDL url
6:- Now doubleclick the button and then type the following cod in the aspx.cs file
ServiceReference1.FactorialwebserviceClient client =
new ServiceReference1.FactorialwebserviceClient();
output:-
Practical-08
Implement FOSS-Cloud Functionality VSI (Virtual Server Infrastructure) Infrastructure as a Service (IaaS),
Creating Virtual Machine or Storage
Steps:
3. Choose Demo-System: 1
Note :- Above mentioned steps aren’t mandatory you can start with the installation process of
virt-viewer as shown below.
1. Install virt-viewer.
2. Install spice-client.0.6.3.
3. Open Browser.
Now choose the ubuntu-16.04.5-desktop-i386 iso-file from the FOSS cloud folder. Then, give
your desired file name to it and click on the upload button.
Once done with the upload process go to the create section in profiles.
Creating a Profile
The profile creates the relationship between the ISO file and the FOSS-Cloud.
1. Open Virtual Machines
2. Choose VM-Profiles
3. Choose the right Base Profile
4. Choose the right architecture (Windows only x86_64)
5. Chose the language (it is a information - not keyboard relevant)
6. Choose the ISO file (which you gave in file name tab)
7. Fill out name and description
8. Choose the amount of memory and volume capacity
9. Choose amount of CPU
10. Choose clock offset (normally Windows is "localtime" and Linux is "utc")
Now, we will create a VM template.
Creating Template
1. Choose the profile you have prepared before.
2. Add the VM-pool and one or more nodes, where you will run this VM (when the chosen VM-
pool has only one node assigned, you don't have a choice)
3. You can change all the other information you have entered before
Click on "create" and the template is ready for installing the guest operating system.
Once you create your virtual machine template you will be able to see your VM template.
As you can see the last row of Display column our template is created.
Just after clicking on, it a pop up would appear to Open remote-viewer? click on Open-remote-
viewer button, you will see the following screen.
Note :- If you don't see the above screen follow the below given steps.
1.First press window + r, then type regedit and click ok.
2. Further permissions tab will open then click yes, and a regedit editor will get open.
3. In the Registry Editor a list of directories would appear, in those lists of directories search
for the spice directory.
4. Keep on expanding the spice directory until you reach the command section.
5. Then click on the default file and a pop up will appear, then you have to paste the path
C:\Users\ADMIN\AppData\Local\virt-viewer\bin in the value data and also type %1 in last.
Once done the above screen will appear.
Finally, after clicking on remote viewer button a command line come where a graphical control
loading and getting connected will be displayed and then finally the ubuntu will get open.
On opening of ubuntu click on try ubuntu. Now, you can use ubuntu on your virtual machine.
Practical-09
Software development Kits can be made available in the Virtual Machines that can be implemented
as Platform as a Service.
Installationof Netbeans, Eclipse, Visual Studio and DBMS can be done in the appropriate Virtual
Aim: Implement FOSS-Cloud Functionality VSI Software as a Service (SaaS)
Applications created and deployed in the virtual machines can be accessed by outside world.
Open Netbeans 8/8.2 --- file --- new project --- java web (left) --- web application(right)
package mypack;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;
@WebService(serviceName = "tempservice")
@WebMethod(operationName = "hello")
@WebMethod(operationName = "F_to_C")
return ((val-32)*5/9);
@WebMethod(operationName = "C_to_F")
Step 4 run
URL http://localhost:8080/tempwebservice/tempWebService?WSDL
//TempClient.java
package tempclient;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
Double t;
int ch;
ch=Integer.parseInt(br.readLine());
System.out.println("Enter temperature");
t=Double.parseDouble(br.readLine());
if(ch==1)
System.out.println("temperature in fahrenheit="+cToF(t));
else
System.out.println("Temperature in celcius="+fToC(t));
return port.cToF(val);
return port.fToC(val);
O/P:
1. Celcius to Fahreheit
2. Fahrenheit to celcius
Enter your Choice
1
Enter temperature
25
temperature in fahrenheit=77.0