IT8711-FOSS - Cloud Computing Lab Manual-Student
IT8711-FOSS - Cloud Computing Lab Manual-Student
IT8711-FOSS - Cloud Computing Lab Manual-Student
for
IT8711– FOSS and CLOUD COMPUTING LABORATORY
of
B.Tech- Information Technology
(Anna University Regulation 2017) For
the Batch (2019 to 2023)
1
KARAPAKKAM, CHENNAI 600 097
LABORATORY RECORD
……………………………………………………………………………………………………… of
………………….semester…………………………………………………………………………….
2
KCG College of Technology, Chennai-600 097
KCG College of Technology aspires to become a globally recognized center of excellence for science,
technology & engineering education, committed to quality teaching, learning, and research while
ensuring for every student a unique educational experience which will promote leadership, job
creation, social commitment and service to nation building
Nurture the virtue of service and an ethical value system in the young minds
3
KCG College of Technology, Chennai-600 097
PEO 2 Design, implement, test and maintain software systems based on various client requirements.
PEO 3 Engage in life long learning and adapt to changing professional and societal needs.
Identify, formulate, research literature, and analyze complex engineering problems reaching
substantiated conclusions using first principles of mathematics, natural sciences, and
PO 2 engineering sciences.
Design solutions for complex engineering problems and design system components or
processes that meet the specified needs with appropriate consideration for the public health
PO 3 and safety, and the cultural, societal, and environmental considerations.
Create, select, and apply appropriate techniques, resources, and modern engineering and IT
tools including prediction and modelling to complex engineering activities with an
PO 5 understanding of the limitations.
Apply reasoning informed by the contextual knowledge to assess social, health, safety, legal
and cultural issues and the consequent responsibilities relevant to the professional engineering
PO 6 practice.
Understand the impact of the professional engineering solutions in societal and environmental
PO 7 contexts, and demonstrate the knowledge of, and for sustainable development.
4
KCG College of Technology, Chennai-600 097
PO 8 Apply ethical principles and commit to professional ethics and responsibilities and norms
of the engineering practice.
PO 9 Function effectively as an individual, and as a member or leader in diverse teams, and in multi-
disciplinary settings.
Demonstrate knowledge and understanding of the engineering and management principles and
PO 11 apply these to one’s own work, as a member and leader in a team, to manage projects and in
multidisciplinary environments.
PO 12 Recognize the need for, and have the preparation and ability to engage in independent life-
long learning in the broadest context of technological change.
Identify the need for sustainable development in software industries and follow the
PSO 3 professional code of ethics.
5
COURSE OUTCOMES WITH HIGHEST COGNITIVE LEVEL
Semester: VII
Regulation: 2017
At the end of the course the students will be able to
Highest
COs Course Outcomes Cognitive Level
6
SYLLABUS
1. Use gcc to compile c-programs. Split the programs to different modules and create an application using
make command.
2. Use version control systems command to clone, commit, push, fetch, pull, checkout, reset, and delete
repositories.
3. Install Virtual box/VMware Workstation with different flavours of linux or windows OS on top of
windows7 or8.
4. Install a C compiler in the virtual machine created using virtual box and execute Simple Programs
5. Install Google App Engine. Create hello world app and other simple web applications using python/java.
6. Use GAE launcher to launch the web applications.
7. Simulate a cloud scenario using CloudSim and run a scheduling algorithm that is not present in CloudSim.
8. Find a procedure to transfer the files from one virtual machine to another virtual machine.
9. Find a procedure to launch virtual machine using trystack (Online Openstack Demo Version)
10. Install Hadoop single node cluster and run simple applications like word count.
SOFTWARE:
Openstack
Hadoop
Eucalyptus or Open Nebula or equivalent
7
INDEX
SL.
NAME OF THE PROGRAM DATE MARKS SIGNATURE
NO.
Install VirtualBox/VMware workstation with
1 different flavours of Linux or windows OS on top of
windows 7 or 8 or 10
Install a C compiler in the virtual machine created
2 using virtual box and execute Simple Programs
Use gcc to compile C-programs. Split the programs to
3 different modules and create an application using
‘make’ command
Use version control systems command to clone,
4 commit, push, fetch, pull, checkout, reset, and delete
repositories
Install Google App Engine. Create hello world app
5
and other simple web applications using python/java.
6 Use GAE launcher to launch the web applications
8
IT8711 FOSS and Cloud Computing Lab
Ex.No:01
Install Virtual Box/VMware Workstation with different flavours of
Linux or windows OS on top of windows 7 or 8 or 10
Date:
Virtualization:
Virtualization is the creation of virtual servers, infrastructures, devices and
computing resources.
Virtualization changes the hardware-software relations and is one of the
foundational elements of cloud computing technology that helps utilize the
capabilities of cloud computing to the full.
Virtualization techniques allow companies to turn virtual their networks,
storage, servers, data, desktops and applications.
Types of Virtualization
Operating-system-level virtualization - is a server-virtualization method
where the kernel of an operating system allows for multiple isolated user-
space instances, instead of just one. Such instances (sometimes called
containers, software containers, virtualization engines (VE), virtual private
servers (VPS), or jails) may look and feel like a real server from the point of
view of its owners andusers
Platform / Hardware virtualization -Hardware virtualization or platform
virtualization refers to the creation of a virtual machine that acts like a real
computer with an operating system. Software executed on these virtual
machines is separated from the underlying hardware resources. For example,
a computer that is running Microsoft Windows may host a virtual machine that
looks like a computer with the Ubuntu Linux operating system; Ubuntu- based
software can be run on the virtual machine. In hardware virtualization, the
host machine is the actual machine on which the virtualization takes place,
and the guest machine is the virtual machine. The words host and guest are
used to distinguish the software that runs on the physical machine from the
software that runs on the virtual machine. Different types of hardware
virtualization include:
o Full virtualization: Almost complete simulation of the actual
hardware to allow software, which typically consists of a guest
operating system, to run unmodified.
o Partial virtualization: Some but not all of the target environment
is simulated. Some guest programs, therefore, may need
modifications to run in this virtual environment.
9
IT8711 FOSS and Cloud Computing Lab
o Para virtualization: A hardware environment is not simulated;
however, the guest programs are executed in their own isolated
domains, as if they are running on a separate system.
Ubuntu
Ubuntu is an operating system like any other and it is free & open source. It
means that we can download it freely and install on as many computers as we
like. By the term open source it means that we can actually see its code. To
provide a more secure environment, the ―SUDO ‖tool is used to assign
temporary privileges for performing administrative tasks. Ubuntu comes
installed with a wide range of Software that includes LibreOffice ,Firefox,
Thunderbird
Step 1:
Download and Install Oracle Virtual Box latest version &Extension package
o https://virtualbox.org/wiki/downloads
Step 2:
Step 3: The files are downloaded in your Local machine and Click the Oracle VirtualBox 6.0.8
Setup Wizard
10
IT8711 FOSS and Cloud Computing Lab
Oracle VM VirtualBox 6.0.8 Setup Wizard is open and follows the steps to install
11
IT8711 FOSS and Cloud Computing Lab
12
IT8711 FOSS and Cloud Computing Lab
13
IT8711 FOSS and Cloud Computing Lab
Step 4: Import the Oracle VM Virtual Extension pack into the Oracle Virtual Box
14
IT8711 FOSS and Cloud Computing Lab
Oracle VMVirtual Extension pack is imported into the Oracle Virtual Box successfully
15
IT8711 FOSS and Cloud Computing Lab
Step 5: Click import Appliance and select CentOS-7.8.2003.com OVA (Open Virtual
Appliance) file from download directory
16
IT8711 FOSS and Cloud Computing Lab
17
IT8711 FOSS and Cloud Computing Lab
18
IT8711 FOSS and Cloud Computing Lab
Step 6: CentOS-7.8.2003.com is installed successfully and click start button to launch the
virtual machine
LoginDetails
o User name :centos
o Password :centos
19
IT8711 FOSS and Cloud Computing Lab
20
IT8711 FOSS and Cloud Computing Lab
Result:
21
IT8711 FOSS and Cloud Computing Lab
Ex.No:02
Install a C compiler in the virtual machine created using
virtual box and execute Simple Programs
Date:
Steps in Installing C or C++ Compiler in Virtual machine and executing simple programs
Source Code:
22
IT8711 FOSS and Cloud Computing Lab
Output:
Result:
The simple C programs are executed with C compiler in the Virtual Machine
successfully and different programs are executed and verified.
23
IT8711 FOSS and Cloud Computing Lab
Review Questions:
1. What is VMWARE?
24
IT8711 FOSS and Cloud Computing Lab
Ex.No:03
Use gcc to compile c-programs. Split the programs to different modules
Aim:
To use gcc to compile c-programs. Split the programs to different modules and create
an application using make command.
Description:
make- utility for building and maintaining groups of programs.
1. Make: The purpose of the make utility is to determine automatically which pieces of
a large program need to be recompiled, and issue the commands to recompile them.
2. You can use make with any programming language whose compiler can be run with a
shell command.
3. In fact, make is not limited to programs. You can use it to describe any task where
some files must be updated automatically from others whenever the others change.
4. To prepare to use make, you must write a file called the make file that describes the
relationships among files in your program, and the states the commands for updating
each file.
5. In a program, typically the executable file is updated from object files, which are in
turn made by compiling source files.
Step 1:
Step 2:
Create a files for any application
(Note : You can use any programming language) for example here we have created 4
files to find factorial.
25
IT8711 FOSS and Cloud Computing Lab
Example:
func1.c
funcheader.h
main.c
func2.c
Makefile all:
File 1:
Filename : func1.c
File 2:
Filename :func2.c
26
IT8711 FOSS and Cloud Computing Lab
File 3:
File 4:
Step 3:
Create Make file
Syntax:
target: (use tab space) prereq1 prereq2..
you can create an executable file for the above application (Factorial)
27
IT8711 FOSS and Cloud Computing Lab
Step 4:
desktop/sample/$ make
gccmain.c func1.c func2.c -o main
desktop/sample/$ ./main
Output:
Result :
Thus the gcc command was executed successfully using make utility command.
28
Review Questions:
3. What is compiler?
29
Ex.No:04 Use version control systems command to clone, commit, push, fetch,
pull, checkout, reset, and delete repositories
Date:
AIM:
Use version control systems command to clone, commit, push, fetch, pull, checkout, reset, and delete
repositories.
FUNCTIONAL DIAGRAM:
COMMANDS:
The commands are,
Clone
Commit
Push
Fetch
Pull
Checkout
Reset
Delete
30
Clone:
The gitclone command is used to create a copy of a specific repository or branch within a repository.
Git is a distributed version control system. Maximize the advantages of a full repository on your own
machine by cloning.
Syntax:
git commit creates a commit, which is like a snapshot of your repository. These commits are snapshots
of your entire repository at specific times. You should make new commits often, based around logical
units of change. Over time, commits should tell a story of the history of your repository and how it came
to be the way that it currently is. Commits include lots of metadata in addition to the contents and
message, like the author, timestamp, andmore.
Syntax:
Push:
gitpush updates the remote branch with local commits. It is one of the four commands in Git that
prompts interaction with the remote repository. You can also think of gitpush as update or publish.
Syntax:
gitpush -u originmain
Pull:
git pull is one of the 4 remote operations within Git. Without running git pull, your local repository
will never be updated with changes from the remote. git pull should be used every day you interact with
a repository with a remote, at the minimum. That's why git pull is one of the most used Git commands.
Syntax:
# General format
gitpull OPTIONS REPOSITORY REFSPEC
31
Checkout:
Use gitcheckout on the command line to create a new branch, change your current working branch
to a different branch, or even to switch to a different version of a file from a different branch with
gitcheckout [branchname] [path to file]. The "checkout" action updates all or part of the working
tree with a tree object or blob from the object database, and updates the index and HEAD if the whole
working tree is pointing to a new branch.
Syntax:
The term reset stands for undoing changes. The git reset command is used to reset the changes. The git
reset command has three core forms of invocation. These forms are as follows.
Soft
Mixed
Hard
Syntax:
gitreset <option><commit-sha>
Delete:
It is common for a Git repo to have different branches. They are a great way to work on different
features and fixes while isolating the new code from the main codebase.
Repos often have a master branch for the main codebase and developers create other branches to work
on different features.
Syntax:
32
IT8711 FOSS and Cloud Computing Lab
33
IT8711 FOSS and Cloud Computing Lab
RESULT:
Thus the program is to use version control systems command to clone, commit, push, fetch, pull,
checkout, reset, and delete repositories is executed successfully.
34
IT8711 FOSS and Cloud Computing Lab
Review questions:
2. What is GIT?
35
IT8711 FOSS and Cloud Computing Lab
Ex. No: 05
Install Google App Engine. Create hello world app and other simple web
applications using python/java.
Date:
Aim:
To install Google App Engine. Create hello world app and other simple web applications using
python/java
Platform as a Service(PaaS)
o Cloud computing service which provides a computing platform and a solution
stack as a service.
o Consumer creates the software using tools and/or libraries from the provider.
o Provider provides the networks, servers, storage,etc.
Google AppEngine:
absolutely free. When you enable billing for your application, your free limits
are raised, and you only pay for resources you use above the free levels.
Architecture of Google AppEngine
38
IT8711 FOSS and Cloud Computing Lab
Google App Engine makes it easy to build an application that runs reliably, even
under heavy load and with large amounts of data. App Engine includes the following
features:
Persistent storage with queries, sorting and transactions
Automatic scaling and load balancing
APIs for authenticating users and sending email using Google Accounts
Task queues for performing work outside of the scope of a web request
Scheduled tasks for triggering events at specified times and regular intervals
Dynamic web serving, with full support for common web technologies
You can develop your application for the Java runtime environment using
common Java web development tools and API standards. Your app interacts
with the environment using the Java Servlets standard, and can use common
web application technologies such as Java Server Pages
The Java runtime environment uses Java6. The AppEngine JavaSDK supports
developing apps using either Java5 or 6.The environment includes the JavaSE
Runtime Environment (JRE) 6 platform and libraries. The restrictions of the
sandbox environment are implemented in the JVM. An app can use any JVM
byte code or library feature, as long as it does not exceed the sandbox
restrictions. For instance, byte code that attempts to open a socket or write to a
file will throw a runtime exception.
Your app accesses most AppEngine services using Java standard APIs. For the
AppEngine data store, the Java SDK includes implementations of the Java Data
Objects (JDO) and Java Persistence API(JPA) interfaces. Your app can use the
JavaMail API to send email messages with the App Engine Mail service. The
java.net HTTP APIs accesses the App Engine URL fetch service.
App Engine also includes low-level APIs for its services to implement
additional adapters, or to use directly from the application. See the
documentation for the data store, memcache, URL fetch, mail, images and
Google Accounts APIs. Typically, Java developers use the Java programming
language and APIs to implement web applications for the JVM. With the use
39
IT8711 FOSS and Cloud Computing Lab
40
IT8711 FOSS and Cloud Computing Lab
41
IT8711 FOSS and Cloud Computing Lab
42
IT8711 FOSS and Cloud Computing Lab
Example :kcet-cloud-project
43
IT8711 FOSS and Cloud Computing Lab
44
IT8711 FOSS and Cloud Computing Lab
45
IT8711 FOSS and Cloud Computing Lab
46
IT8711 FOSS and Cloud Computing Lab
47
IT8711 FOSS and Cloud Computing Lab
48
IT8711 FOSS and Cloud Computing Lab
main.py file
49
IT8711 FOSS and Cloud Computing Lab
app.yaml
requirements.txt
Flask==0.11.1
gunicorn==19.6.0
50
IT8711 FOSS and Cloud Computing Lab
51
IT8711 FOSS and Cloud Computing Lab
It started building the object and fetching the storage object for the created application
52
IT8711 FOSS and Cloud Computing Lab
curve-289413.uc.r.appspot.com
53
IT8711 FOSS and Cloud Computing Lab
Result:
Thus the Google App Engine is installed successfully and a web application to display hello
world using python is developed and deployed in the GAE and used GAE Launcher to launch the
web applications.
54
IT8711 FOSS and Cloud Computing Lab
Review Questions:
2. What is compiler?
55
IT8711 FOSS and Cloud Computing Lab
Ex.No:06
Use GAE launcher to launch the web applications
Date:
AIM:
To install the Google App Engine Software Development Kit (SDK) on a
Microsoft Windows and running a simple “hello world” application.
PROCEDURE:
If you don't already have Python 2.5.4 installed in your computer, download
and Install Python 2.5.4 from:
http://www.python.org/download/releases/2.5.4/
You can download the Google App Engine SDK by going to:
http://code.google.com/appengine/downloads.html and
56
IT8711 FOSS and Cloud Computing Lab
Download the Windows installer – the simplest thing is to download it to our Desktop or another
folder that you remember.
Click through the installation wizard, and it should install the App Engine. If you do not
have Python 2.5, it will install Python 2.5 as well.
Once the install is complete you can discard the downloaded installer
57
IT8711 FOSS and Cloud Computing Lab
Now you need to create a simple application. We could use the “+” option to have the
launcher make us an application – but instead we will do it by hand to get a better sense
of what is going on.
Make a folder for your Google App Engine applications. I am going to make the Folder on
my Desktop called “apps” – the path to this folder is:
And then make a sub-‐folder in within apps called “ae-•01-•trivial”–the path to this
folder would be:
Using a text editor such as JEdit (www.jedit.org), create a file called app.yaml in the ae-•01-•trivial folder with the
following contents:
application: ae-01-trivial
version: 1 runtime: python
api_version: 1
handlers:
- url: /.*
script: index.py
Note: Please do not copy and paste these lines into your text editor – you might end
up with strange characters – simply type them into your editor.
Then create a file in the ae-•01-•trivial folder called index.py with three lines in it:
58
IT8711 FOSS and Cloud Computing Lab
Once you have selected your application and press Run. After a few moments your
application will start and the launcher will show a little green icon next to your application.
Then press Browse to open a browser pointing at your application which is running at
http://localhost:8080/
Paste http://localhost:8080 into your browser and you should see your application as follows:
Just for fun, edit the index.py to change the name “Chuck” to your own name and press Refresh in
the browser to verify your updates.
You can watch the internal log of the actions that the webserver is performing when you are interacting
with your application in the browser. Select your application in the Launcher and press the Logs
button to bring up a log window:
59
IT8711 FOSS and Cloud Computing Lab
Each time you press Refresh in your browser – you can see it retrieving the output with a GET
request.
With two files to edit, there are two general categories of errors that you may encounter. If you
make a mistake on the app.yaml file, the App Engine will not start and your launcher will show
a yellow icon near your application:
60
IT8711 FOSS and Cloud Computing Lab
To get more detail on what is going wrong, take a look at the log for the application:
In this instance– the mistake is mis-‐indenting the last line in the app.yaml(line8).
If you make a syntax error in the index.py file, a Python trace back error will appear in your browser.
The error you need to see is likely to be the last few lines of the output – in this case I made a
Python syntax error on line one of our one-‐line application.
Reference: http://en.wikipedia.org/wiki/Stack_trace
61
IT8711 FOSS and Cloud Computing Lab
When you make a mistake in the app.yamlfile – you must the fix the mistake and attempt to start
the application again.
If you make a mistake in a file like index.py, you can simply fix the file and press refresh in your browser
– there is no need to restart the server.
To shut down the server, use the Launcher, select your application and press the Stop button.
Alternate Method
1. Download and install Cloud SDK:
You see project details that might look like the following:
createTime: year-month-hour
lifecycleState: ACTIVE
name: project-name
parent:
id: '433637338589'
type: organization
projectId: project-name-id
projectNumber: 499227785679
3. Initialize your App Engine app with your project and choose its region:
62
IT8711 FOSS and Cloud Computing Lab
When prompted, select the region where you want your App Engine application located.
Caution: You cannot change an app's region once it has been set.
4. Make sure billing is enabled for your project. A billing account needs to be linked to your
project in order for the application to be deployed to AppEngine.
Enable billing
Note: Running this sample app does not exceed your free quota.
6. Prepare your environment for Python development. It is recommended that you have the latest
version of Python, pip, and other related tools installed on your system. For instructions, refer to the
Python Development Environment Setup Guide.
This quickstart demonstrates a simple Python app written with the Flaskweb framework that can be
deployed to App Engine. Although this sample uses Flask, you can use any web framework that satisfies
the requirements above. Alternative frameworks include Django, Pyramid, Bottle, and web.py.
We've created a simple Hello World app for Python 3 so you can quickly get a feel for deploying
an app to the Google Cloud.
1. Clone the Hello World sample app repository to your local machine.
Alternatively, you can download the sampleas a zip file and extract it.
2. Change to the directory that contains the samplecode.
cd python-docs-samples/appengine/standard_python3/hello_world
Mac OS / Linux/Windows
1. Create an isolated Python environment in a directory external to your project and activate it:
python3 -m venvenv
source env/bin/activate
2. Navigate to your project directory and install dependencies:
Cd YOUR_PROJECT
pip install -r requirements.txt
3. Run the application:
pythonmain.py
4. In your web browser, enter the following address:
http://localhost:8080
Note: If you are using Cloud Shell, in the toolbar, click Web Preview and select Preview on port
8080 instead.
The Hello World message from the sample app displays on the page. In your terminal
window, press Ctrl+C to exit the web server.
gcloud appdeploy
Learn about the optional flags.
2. Launch your browser to view the app at https://PROJECT_ID.REGION_ID.r.appspot.com
This time, the page that displays the Hello World message is delivered by a web server running on an App
Engine instance.
Congratulations! You've deployed your first Python 3 app to App Engine standard environment!
See the following sections for information about cleaning up as well as links to possible next steps that
you can take.
64
IT8711 FOSS and Cloud Computing Lab
Clean up
To avoid incurring charges, you can delete your Cloud project to stop billing for all the resources used
within that project.
Result:
Thus the installation of Google cloud SDK on the system and creating the hello world app is
completed successfully
65
IT8711 FOSS and Cloud Computing Lab
Review Questions:
1. What is GAE?
2. What is ASP?
3. What is JSP?
5. What is SDK?
66
IT8711 FOSS and Cloud Computing Lab
Ex.No:07.A
Simulate a cloud scenario using CloudSim
Date:
Introduction:
CloudSim
A Framework for modeling and simulation of Cloud Computing
Infrastructures and services
Originally built at the Cloud Computing Distributed Systems (CLOUDS)
Laboratory, The University of Melbourne,Australia
It is completely written in JAVA
Main Features of CloudSiM
Modeling and simulation
Data centre network topologies and message-passing applications
Dynamic insertion of simulation elements
Stop and resume of simulation
Policies for allocation of hosts and virtual machines
Cloudsim –Essentials
JDK 1.6 or abovehttp://tinyurl.com/JNU-JAVA
Eclipse 4.2 or abovehttp://tinyurl.com/JNU-Eclipse
AlternativelyNetBeanshttps://netbeans.org/downloads
Up & Running with cloudsim guide:https://goo.gl/TPL7Zh
Cloudsim-Directory structure
cloudsim/ -- top level CloudSimdirectory
docs/ -- CloudSim APIDocumentation
examples/ -- CloudSimexamples
jars/ -- CloudSim jararchives
sources/ -- CloudSim sourcecode
67
IT8711 FOSS and Cloud Computing Lab
Cloudsim - Majorblocks/Modules
o org.cloudbus.cloudsim
o org.cloudbus.cloudsim.core
o org.cloudbus.cloudsim.core.predicates
o org.cloudbus.cloudsim.distributions
o org.cloudbus.cloudsim.lists
o org.cloudbus.cloudsim.network
o org.cloudbus.cloudsim.network.datacenter
o org.cloudbus.cloudsim.power
o org.cloudbus.cloudsim.power.lists
o org.cloudbus.cloudsim.power.models
o org.cloudbus.cloudsim.provisioners
o org.cloudbus.cloudsim.util
Cloudsim - keycomponents
o Datacenter
o DataCenterCharacteristics
o Host
o DatacenterBroker
o RamProvisioner
o BwProvisioner
o Storage
o Vm
o VMAllocationpolicy
o VmScheduler
o Cloudlet
o CloudletScheduler
o CloudInformationService
o CloudSim
o CloudSimTags
o SimEvent
o SimEntity
o CloudsimShutdown
o FutureQueue
o DefferedQueue
o Predicate and associativeclasses.
68
IT8711 FOSS and Cloud Computing Lab
CloudSim Elements/Components
Step 1: Link to download Eclipse and download Eclipse for Windows 64bit into your Local
machine
https://www.eclipse.org/downloads/packages/release/kepler/sr1/eclipse-ide-java-
developers
Windows x86_64
69
IT8711 FOSS and Cloud Computing Lab
Step 2: Download cloudsim-3.0.3 from git hub repository in your local machine
https://github.com/Cloudslab/cloudsim/releases/tag/cloudsim-3.0.3
Cloudsim-
Step 3: Download commons-maths3-3.6.1 from git hub repository in your local machine
https://commons.apache.org/proper/commons-math/download_math.cgi
Commons-
maths3-3.6.1-
bin.zip
70
IT8711 FOSS and Cloud Computing Lab
Downloaded Files
Step 5: First of all, navigate to the folder where you have unzipped the eclipse folder and
open Eclipse.exe
71
IT8711 FOSS and Cloud Computing Lab
Step 6: Now within Eclipse window navigate the menu: File -> New -> Project, to open the
new project wizard
Step 7: A ‗New Project‗ wizard should open. There are a number of options displayed and
you have to find & select the ‗Java Project‗ option, once done click ‘Next‗
72
IT8711 FOSS and Cloud Computing Lab
Step 8: Now a detailed new project window will open, here you will provide the project name
and the path of CloudSim project source code, which will be done as follows:
Step 9: Unselect the ‘Use default location’ option and then click on ‘Browse’ to open the path
where you have unzipped the Cloudsim project and finally click Next to set project settings.
73
IT8711 FOSS and Cloud Computing Lab
Step 10: Make sure you navigate the path till you can see the bin, docs, examples etc folder in the
navigation plane.
Step 11: Once done finally, click ‗Next‘ to go to the next step i.e. setting up of project
settings
Step 12: Now open ‘Libraries’ tab and if you do not find commons-math3-3.x.jar (here ‘x’
means the minor version release of the library which could be 2 or greater) in the list then
simply click on ‗Add External Jar’ (commons-math3-3.x.jar will be included in the project
74
IT8711 FOSS and Cloud Computing Lab
from this step)
Step 13: Once you have clicked on ‗Add External JAR’s‗ Open the path where you have
unzipped the commons-mathbinaries and select‗Commons-math3-3.x.jar‘ and click on open.
75
IT8711 FOSS and Cloud Computing Lab
Step 14: Ensure external jar that you opened in the previous step is displayed in the list and
then click on ‗Finish‘ (your system may take 2-3 minutes to configure the project)
Step15:Once the project is configured you can open the ‗ProjectExplorer‗ and start exploring
the Cloudsim project. Also for the first time eclipse automatically start building the workspace
for newly configured Cloudsim project, which may take some time depending on the
configuration of the computer system.
Following is the final screen which you will see after Cloudsim is configured.
76
IT8711 FOSS and Cloud Computing Lab
Step 16: Now just to check you within the ‗Project Explorer‗, you should navigate to the
‗examples‗ folder, then expand the package ‗org.cloudbus.cloudsim.examples‗ and double
click to open the ‗CloudsimExample1.java‗
77
IT8711 FOSS and Cloud Computing Lab
Step 17: Now navigate to the Eclipse menu ‗Run ->Run‗ or directly use a keyboard
shortcut ‘Ctrl + F11’ to execute the ‗CloudsimExample1.java‗.
78
IT8711 FOSS and Cloud Computing Lab
Step 18: If it is successfully executed it should be displaying the following type to output in
the console window of the Eclipse IDE.
Result:
79
IT8711 FOSS and Cloud Computing Lab
Ex.No:07.B
Run a scheduling algorithm using CloudSim
Date:
Step 1: Link to download Eclipse and download Eclipse for Windows 64bit into your Local
machine
https://www.eclipse.org/downloads/packages/release/kepler/sr1/eclipse-ide-java-
developers
Windows x86_64
Step 2: Download scheduling source code cloudsim-code-master from git hub repository in
your local machine
https://github.com/shiro873/Cloudsim-Code
Src-schedulingsource
files
80
IT8711 FOSS and Cloud Computing Lab
Step 3: Download commons-maths3-3.6.1 from git hub repository in your local machine
https://commons.apache.org/proper/commons-math/download_math.cgi
Commons-maths3-
3.6.1-bin.zip
Step 4: Downloaded Eclipse, cloudsim-3.0.3 and Apache Commons Math 3.6.1 in your local
machine and extract cloudsim-3.0.3 and Apache Commons Math 3.6.1
Downloaded Files
81
IT8711 FOSS and Cloud Computing Lab
Step 5: First of all, navigate to the folder where you have unzipped the eclipse folder and
open Eclipse.exe
Step 6: Now within Eclipse window navigate the menu: File -> New -> Project, to open the
new project wizard
82
IT8711 FOSS and Cloud Computing Lab
Step 7: A ‗New Project‗ wizard should open. There are a number of options displayed and
you have to find & select the ‗Java Project‗ option, once done click ‘Next‗
Step 8: Now a detailed new project window will open, here you will provide the project name
and the path of CloudSim-master-code project source code, which will be done as follows:
83
IT8711 FOSS and Cloud Computing Lab
Step 9: Unselect the ‘Use default location’ option and then click on ‘Browse’ to open the path where
you have unzipped the Cloudsim-code-masterproject and finally click Next to set project settings.
Step 10: Make sure you navigate the path till you can see the bin, docs, examples etc folder in the
navigation plane.
84
IT8711 FOSS and Cloud Computing Lab
Step 11: Once done finally, click ‘Next‘ to go to the next step i.e. setting up of project settings
Step 12: Once the project is configured you can open the ‗Project Explorer‗ and start exploring the
Cloudsim project. Also for the first time eclipse automatically start building the workspace for newly
configured Cloudsim project, which may take some time depending on the configuration of the
computer system.
Following is the final screen which you will see after Cloudsim is configured.
85
IT8711 FOSS and Cloud Computing Lab
Step13: Now just to check you with in the‗ProjectExplorer‗,you should navigate to the ‗src‗ folder,
then expand the package ‗default package‗ and double click to open the ‗RoundRobin.java‗.
Step 14: Now navigate to the Eclipse menu ‗Run ->Run‗ or directly use a keyboard shortcut ‘Ctrl
+ F11’ to execute the ‘RoundRobin.java‘. If it is successfully executed it should be displaying the
following type to output in the console window of the Eclipse IDE.
86
IT8711 FOSS and Cloud Computing Lab
Result:
87
IT8711 FOSS and Cloud Computing Lab
Review Questions:
1. What is cloudSim?
3. What is scheduling?
5. What is VM scheduler?
88
IT8711 FOSS and Cloud Computing Lab
Ex.No:08
Procedure File Transfer in Client & Server using virtual machine
Date:
Aim:
Source Code:
FTPClient.java
89
IT8711 FOSS and Cloud Computing Lab
90
IT8711 FOSS and Cloud Computing Lab
FTPServer.java
91
IT8711 FOSS and Cloud Computing Lab
Output:
Result:
Thus the program to the File transfer operation using virtual machine was successfully
executed and verified.
92
IT8711 FOSS and Cloud Computing Lab
Review questions:
1. What is client?
2. What is server?
3. What is socket?
5. Describe the corer mechanism behind file transfer between client and server.
93
IT8711 FOSS and Cloud Computing Lab
Ex.No: 09
Find a procedure to launch virtual machine using trystack (Online Openstack
Date: Demo Version)
Aim:
To find a procedure to launch virtual machine using Openstack
Introduction:
OpenStack was introduced by Rackspace and NASA in July2010.
OpenStackis an Infrastructure as a Service known as Cloud Operating System, that
takeresourcessuchasCompute,Storage,NetworkandVirtualizationTechnologiesand
control those resources at a data center level
Theprojectisbuildinganopensourcecommunity-toshareresourcesandtechnologies with
the goal of creating a massively scalable and secure cloudinfrastructure.
The software is open source and limited to just open source APIs such asAmazon.
OpenStack architecture
It is modular architecture
Designed to easily scale out
Based on (growing) set of core services
The major components are
1. Keystone
2. Nova
3. Glance
4. Swift
5. Quantum
6. Cinder
94
IT8711 FOSS and Cloud Computing Lab
KEYSTONE :
o Identity service
o Common authorization framework
o Manage users, tenants and roles
o Pluggable back ends (SQL,PAM,LDAP, IDMetc)
NOVA
o Core compute service comprised of
Compute Nodes – hypervisors that run virtual machines
Supports multiple hypervisors KVM,Xen,LXC,Hyper-V
and ESX
Distributed controllers that handle scheduling, API calls, etc
Native OpenStack API and Amazon EC2 compatible
API
GLANCE
o Image service
o Stores and retrieves disk images (Virtual machinetemplates)
o Supports RAW,QCOW,VHD,ISO,OVF &AMI/AKI
o Backend Storage : File System, Swift, Gluster, AmazonS3
SWIFT
o Object Storage service
o Modeled after Amazon‘s Service
o Provides simple service for storing and retrieving arbitrary data
o Native API and S3 compatible API
NEUTRON
o Network service
o Provides framework for Software Defined Network
o Plugin architecture
Allows integration of hardware and software based network
solutions
Open vSwitch, Cisco UCS, Standard Linux Bridge,
NiCiraNVP
95
IT8711 FOSS and Cloud Computing Lab
CINDER
o Block Storage (Volume)service
o Provides block storage for Virtual machines(persistent disks)
o Similar to Amazon EBS service
o Plugin architecture for vendor extensions
NetApp driver for cinder
HORIZON
o Dashboard
o Provides simple self service UI for end-users
o Basic cloud administrator functions
Define users, tenants and quotas
No infrastructure management
HEAT OpenStack Orchestration
o Provides template driven cloud application orchestration
o Modeled after AWS Cloud Formation
o Targeted to provide advanced functionality such as high availability
and auto scaling
o Introduced byRedhat
CEILOMETER – OpenStack Monitoring and Metering
o Goal: To Provide a single infrastructure to collect measurements from
an entire OpenStack Infrastructure; Eliminate need for multiple agents
attaching to multiple OpenStack Projects
o Primary targets metering and monitoring: Providedextensibility
96
IT8711 FOSS and Cloud Computing Lab
Login Details
o User name :centos
o Password :centos
To change into root user in Terminal
#sudo su–
97
IT8711 FOSS and Cloud Computing Lab
98
IT8711 FOSS and Cloud Computing Lab
Step 8: OpenStack will be deployed on your Node with the help of PackStack package
provided by rdo repository (RPM Distribution of OpenStack). In order to enable rdo
repositories on Centos 7 run the below command.
#yum update –y
99
IT8711 FOSS and Cloud Computing Lab
#packstak --allinone
#cat keystonerc_admin
100
IT8711 FOSS and Cloud Computing Lab
Step 13: Click the URL and enter the user name and password to start OpenStack
101
IT8711 FOSS and Cloud Computing Lab
Result:
Review Questions:
2. What is mount?
4. What is VM?
103
IT8711 FOSS and Cloud Computing Lab
Ex.No:10.A
Install Hadoop single node cluster
Date :
Aim:
To find procedure to set up the one node Hadoop cluster.
Procedure:
Step:1
Installing Java is the main prerequisite for Hadoop. Install java1.7.
Step 2:
SSH Server accepting password authentication (at least for the setup
student@a4cse196:~$
su Password:
Step 3:
Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in
/root/.ssh/id_rsa.pub
104
IT8711 FOSS and Cloud Computing Lab
77:a1:20:bb:db:95:6d:89:ce:44:25:32:b6:81:5d:d5
| .... |
| o. E|
| oB.o |
| +*+. |
| .S+. |
| .o=. |
| .=+ |
| o=. |
| . .o |
+ +
Step 4:
If the master also acts a slave (`sshlocalhost` should work without a password)
>>$HOME/.ssh/authorized_keys
Step5:
Adding new user `hadoop' (1003) with group `hadoop' ... Creating
Other []:
root@a4cse196:/home/student#
Step 6:
Step 7:
Step 8:
Step 9:
root@a4cse196:/home/student# sudomkdir -p
106
IT8711 FOSS and Cloud Computing Lab
/var/lib/hadoop/hdfs/namenoderoot@a4cse196:/home/student# sudomkdir
-p /var/lib/hadoop/hdfs/datanoderoot@a4cse196:/home/student#
Step 10:
root@a4cse196:/home/student# readlink -f
/usr/bin/java
/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
Step 11:
root@a4cse196:/home/student# gedit
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-
amd64 export
HADOOP_INSTALL=/usr/local/lib/hadoop-2.7.0 export
PATH=$PATH:$HADOOP_INSTALL/bin
export PATH=$PATH:$HADOOP_INSTALL/sbin
export
HADOOP_MAPRED_HOME=$HADOOP_INSTALL
export
HADOOP_COMMON_HOME=$HADOOP_INSTALL
export HADOOP_HDFS_HOME=$HADOOP_INSTALL
export YARN_HOME=$HADOOP_INSTALL
export
HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_INSTALL/lib/native
107
IT8711 FOSS and Cloud Computing Lab
export HADOOP_OPTS="-Djava.library.path=$HADOOP_INSTALL/lib/native"
Step 12:
Reload source
Step 13:
2.7.0/etc/hadooproot@a4cse196:/usr/local/lib/hadoop-2.7.0/etc/hadoop#
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
Step 14:
site.xml
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:9000</value>
</property>
</configuration>
Step 15:
<configuration>
108
IT8711 FOSS and Cloud Computing Lab
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
<property>
<name>yarn.nodemanager.aux-services.mapreduce.shuffle.class</name>
<value>org.apache.hadoop.mapred.ShuffleHandler</value>
</property>
</configuration>
Step 16:
Step 17:
<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration>
Step 18:
109
IT8711 FOSS and Cloud Computing Lab
site.xml
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>dfs.namenode.name.dir</name>
<value>file:/var/lib/hadoop/hdfs/namenode</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>file:/var/lib/hadoop/hdfs/datanode</value>
</property>
</configuration>
Step 19:
$gedit /etc/profile
JAVA_HOME=/usr/lib/jvm/java-7-openjdk-
amd64 PATH=$PATH:$JAVA_HOME/bin
export JAVA_HOME
export PATH
$source /etc/profile
Step 20:
110
IT8711 FOSS and Cloud Computing Lab
root@a4cse196:/usr/local/lib/hadoop-2.7.0/etc/hadoop# hdfsnamenode -format
Step 21:
yesyes
start-
yarn.shroot@a4cse196:/home/hado
6498 ResourceManager
6927 Jps
6142 DataNode
5990 NameNode
6696 NodeManager
Step 22:
Browse the web interface for the Name Node; by default it is available at:
http://localhost:50070
Result:
Thus the procedure to set up the one node Hadoop cluster was successfully done and verified.
111
IT8711 FOSS and Cloud Computing Lab
Ex.No: 10.B
Word Count Program Using Map And Reduce
Date:
Aim:
Procedure:
Program: WordCount.java
112
IT8711 FOSS and Cloud Computing Lab
113
IT8711 FOSS and Cloud Computing Lab
For compilation we need this hadoop-core-1.2.1.jar file to compile the map reduce program.
https://mvnrepository.com/artifact/org.apache.hadoop/hadoop-core/1.2.1
Assuming both jar and java files in same directory run the following command to
Syntax:
Output:
Syntax:
hdfsdfs -mkdirdirectoryname
Output:
Output:
Syntax:
114
IT8711 FOSS and Cloud Computing Lab
Output:
InputFile: (input.txt)
Cloud and Grid Lab. Cloud and Grid Lab. Cloud Lab.
Output:
18
3 Cloud
3 Lab.
2 Grid
2 and
In the Utilities tab select browse file system and select the correct user. The output is available inside the
115
IT8711 FOSS and Cloud Computing Lab
Syntax:
Output:
Result:
Thus the numbers of words were counted successfully by the use of Map and Reduce tasks.
116
IT8711 FOSS and Cloud Computing Lab
Review Questions:
1. What is Map?
2. What is Reduce?
117
IT8711 FOSS and Cloud Computing Lab
1. Develop a new Web Service for Calculator.
OBJECTIVE:
To develop a new Web service for Calculator applications.
PROCEDURE:
When you start Globus toolkit container, there will be number of services starts up. The service for
this task will be a simple Math service that can perform basic arithmetic for a client.
Usually, the best way for any programming task is to begin with an overall description of what
you want the code to do, which in this case is the service interface. The service interface
describes how what the service provides in terms of names of operations, their arguments and
return values. A Java interface for our service is:
It is possible to start with this interface and create the necessary WSDL file using the standard
Web service tool called Java2WSDL. However, the WSDL file for GT 4 has to include details
of resource properties that are not given explicitly in the interface above. Hence, we will provide
the WSDL file.
118
IT8711 FOSS and Cloud Computing Lab
WSDL service interface description file -- The WSDL service interface description
file is provided within the GT4services folder at:
GT4Services\schema\examples\MathService_instance\Math.wsdl
The Java code for the service and its resource properties is located within the GT4 services
folder at:
GT4services\org\globus\examples\services\core\first\impl\MathService.java. Deployment
Descriptor -- The deployment descriptor gives several different important sets of information
about the service once it is deployed. It is located within the GT4services folder at:
GT4services\org\globus\examples\services\core\first\deploy-server.wsdd.
It is now necessary to package all the required files into a GAR (Grid Archive) file. The build tool
ant from the Apache Software Foundation is used to achieve this as shown overleaf: Generating a
GAR file with Ant (from http://gdp.globus.org/gt4- tutorial/multiplehtml/ch03s04.html).
Ant is similar in concept to the Unix make tool but a java tool and XML based. Build scripts are
provided by Globus 4 to use the ant build file. The windows version of the build script for
MathService is the Python file called globus-build- service.py, which held in the GT4services
directory. The build script takes one argument, the name of your service that you want to deploy.
To keep with the naming convention in [1], this service will be called first. In the Client Window,
run the build script from the GT4services directory with:
globus-build-service.py first
Buildfile: build.xml
.
.
.
.
.
119
IT8711 FOSS and Cloud Computing Lab
BUILD SUCCESSFUL
During the build process, a new directory is created in your GT4Services directory that is
named build. All of your stubs and class files that were generated will be in that directory and
its subdirectories. More importantly, there is a GAR (Grid Archive) file called
org_globus_examples_services_core_first.gar. The GAR file is the package that contains
every file that is needed to successfully deploy your Math Service into the Globus container.
The files contained in the GAR file are the Java class files, WSDL, compiled stubs, and the
deployment descriptor.
If the container is still running in the Container Window, then stop it using Control- C. To deploy
the MathService, you will use a tool provided by the GlobusToolkit called globus-deploy-gar. In
the Container Window, issue the command:
globus-deploy-garorg_globus_examples_services_core_first.gar
120
IT8711 FOSS and Cloud Computing Lab
A client has already been provided to test the Math Service and is located in the
GT4Services directory at:
GT4Services\org\globus\examples\clients\MathService_instance\Client.java
and contains the following code:
packageorg.globus.examples.clients.MathService_insance; import
org.apache.axis.message.addressing.Address;
importorg.apache.axis.message.addressing.EndpointReferenceType;
importorg.globus.examples.stubs.MathService_instance.MathPortType;
import org.globus.examples.stubs.MathService_instance.GetValueRP;
import
org.globus.examples.stubs.MathService_instance.service.MathServiceAddressingLo
cator;
public class Client {
public static void main(String[] args) {
MathServiceAddressingLocator locator = new
MathServiceAddressingLocator()
try {
String serviceURI = args[0];
// Create endpoint reference to service
EndpointReferenceType endpoint = new
EndpointReferenceType();
endpoint.setAddress(new Address(serviceURI));
MathPortType math;
// Get PortType
121
IT8711 FOSS and Cloud Computing Lab
math = locator.getMathPortTypePort(endpoint);
// Perform an addition
math.add(10);
// Perform another addition
math.add(5);
// Access value
System.out.println("Current value: "
+ math.getValueRP(new GetValueRP()));
// Perform a subtraction
math.subtract(5);
// Access value
System.out.println("Current value: "
+ math.getValueRP(new GetValueRP()));
} catch (Exception e) {
e.printStackTrace();
}
}
}
When the client is run from the command line, you pass it one argument. The argument is the
URL that specifies where the service resides. The client will create the end point reference and
incorporate this URL as the address. The end point reference is then used with the
getMathPortTypePort method of a MathServiceAdressingLocator objectto obtain a
reference to the Mathinterface (portType). Then, we can apply the methods available in the
service as though they were local methods Notice that the call to the service (add and subtract
methodcalls) must be in a“try{}catch(){}”blockbecausea“RemoteException” may be thrown.
The code for the “MathServiceAddressingLocator” is created during the build process.
To compile the new client, you will need the JAR files from the Globus toolkit in your
CLASSPATH. Do this by executing the following command in the Client Window:
%GLOBUS_LOCATION%\etc\globus-devel-env.bat
You can verify that this sets your CLASSPATH, by executing the command:
echo %CLASSPATH%
Running\gt4\etc\globus-devel-env.batonlyneedstobedoneonceforeachClientWindowthat you
open. It does not need to be done each time you compile.
(b) CompilingClient
Once your CLASSPATH has been set, then you can compile the Client code by typing in the
following command:
122
IT8711 FOSS and Cloud Computing Lab
javac -classpath build\classes\org\globus\examples\services\core\first\impl\:%CLASS
PATH% org\globus\examples\clients\MathService_instance\Client.java
To start the client from your GT4Services directory, do the following in the Client Window, which
passes the GSH of the service as an argument:
Current value:15
Current value:10
Before we can add functionality to the MathService, we must undeploy the service. In the
ContainerWindow, kill the container with a Control-C. Then to undeploy the service, type in
the following command:
globus-undeploy-garorg_globus_examples_services_core_first
which should result with the following output:
Undeploying gar...
Deleting /.
.
.
Undeploy successful
Keep all file names the same and simply redeploy the service afterwards. You will also need to
add a code to the client code (Client.java) to test the modified service to include multiplication.
Result:
Thus the Develop a new Web Service for Calculator was executed successfully.
123
IT8711 FOSS and Cloud Computing Lab
OBJECTIVE:
PROCEDURE:
Writing and deploying a WSRF Web Service is easier than you might think. You just
have to follow five simple steps
To run this program, as a minimum you will be required to have installed the
following prerequisite software
a. Download the latest Axis2 runtime from the above link and extract it. Now we
point Eclipse WTP to downloaded Axis2 Runtime. Open Window ->Preferences
-> Web Services -> Axis2 Emitter
Select the Axis2 Runtime tab and point to the correct Axis2 runtime location.
Alternatively at the Axis2 Preference tab, you can set the default setting that will
come up on the Web Services Creation wizards. For the moment we will accept
the default settings.
b. ClickOK.
124
IT8711 FOSS and Cloud Computing Lab
c. Next we need to create a project with the support of Axis2 features. Open File ->
New -> Other... -> Web -> Dynamic WebProject
Click next
d. Select the name Axis2WSTest as the Dynamic Web project name (you canspecify
any name you prefer), and select the configured Tomcat runtime as the target
runtime.
Click next.
e. Select the Axis2 Web servicefacet
Click Finish.
125
IT8711 FOSS and Cloud Computing Lab
126
IT8711 FOSS and Cloud Computing Lab
h. Select Converter.java, open File -> New -> Other... -> Web Services -> Web
Service
Click next.
i. The Web service wizard would be brought up with Web service type setto
Bottom up Java bean Web Service with the service implementation
automatically filled in. Move the service scale to Startservice.
127
IT8711 FOSS and Cloud Computing Lab
Click OK.
k. Ensure that the correct server and service project are selected as displayedbelow.
Click next.
128
IT8711 FOSS and Cloud Computing Lab
This page is the service.xml selection page. if you have a custom services.xml,
you can include that by clicking the Browse button. For the moment, just leaveit
at the default.
Click next.
l. This page is the Start Server page. It will be displayed if the server has not been
started. Click on the Start Server button. This will start the server runtime.
Click next.
129
IT8711 FOSS and Cloud Computing Lab
Click Finish.
n. Now, select the Axis2WSTest dynamic Web project, right-click and select Run ->
Run As -> Run on Server to bring up the Axis2servlet.
Click Next.
130
IT8711 FOSS and Cloud Computing Lab
o. Make sure you have the Axis2WSTest dynamic Web project on the right-hand
side under the Configured project.
Click Finish.
p. This will deploy the Axis2 server webapp on the configured servlet container
and will display the Axis2 home page. Note that the servlet container will start
up according to the Server configuration files on your workspace.
q. Click on the Services link to view the available services. The newly
created converter Web service will be shown there.
131
IT8711 FOSS and Cloud Computing Lab
r. Click on the Converter Service link to display the WSDL URL of the newly
created Web service. Copy the URL.
s. Now we'll generate the client for the newly created service by referring the WSDL
generated by the Axis2 Server. Open File -> New -> Other... -> Web Services ->
WebServiceClient
132
IT8711 FOSS and Cloud Computing Lab
t. Paste the URL that was copied earlier into the service definition field.
133
IT8711 FOSS and Cloud Computing Lab
u. Click on the Client project hyperlink and enter Axis2WSTestClient as the name
of the client project. Click OK.
Back on the Web Services Client wizard, make sure the Web service runtime is
set to Axis2 and the server is set correctly. Click Next.
134
IT8711 FOSS and Cloud Computing Lab
Next page is the Client Configuration Page. Accept the defaults and click Finish.
The Clients stubs will be generated to your Dynamic Web project Axis2WSTestClient.
Now we are going to write Java main program to invoke the client stub. Import the
ConverterClient.javafile to the workspace into the wtp package in the src folder
ofAxis2WSTestClient.
135
IT8711 FOSS and Cloud Computing Lab
Then select the ConverterClient file, right-click and select Run As -> Java
Application. Here's what you get on the server console:
Another way to test and invoke the service is to select Generate test case to test the
service check box on the Axis2 Client Web Service Configuration Page when going
through the Web Service Client wizard.
136
IT8711 FOSS and Cloud Computing Lab
If that option is selected, the Axis2 emitter will generate JUnittestcases matching the
WSDL we provide to the client. These JUnittestcases will be generated to a newly added
source directory to the Axis2WSTestClient project called test.
Next thing we need to do is to insert the test case with the valid inputs as the Web
service method arguments. In this case, let's test the
ConverterConverterSOAP11Port_httpTest.java by provide values for Celsius and
Farenheit for the temperature conversion. As an example, replace the generated
TODO statement in each test method to fill in
137
the data with values as: IT8711 FOSS and Cloud Computing Lab
Here the testcases were generated to test both the synchronous and
asynchronous clients.
v. After that, select the testcase, right-click, select Run As ->JUnit Test. You will be
able to run the unit test successfully invoking the Webservice.
138
IT8711 FOSS and Cloud Computing Lab
The Web Service wizard orchestrates the end-to-end generation, assembly, deployment,
installation and execution of the Web service and Web service client. Now that your Web
service is running, there are a few interesting things you can do with this WSDL file.
Examples:
RESULT:
Thus the development of a new OGSA-compliant web service was executed successfully.
139