Cs6501 Internet Programming
Cs6501 Internet Programming
System.out.println(s1.getName() ); }
s1.start(); }
} class MT
} {
O/p:- public static void main(String
Thread-0 name of thread1 aad[])
Bala Thread name modified {
0 for loop’s i value printed class1 c1=new class1();
Bala current thread name is printed class2 c2=new class2();
1 for loop’s i value printed c1.start();
Bala current thread name is printed c2.start();
}
1.7.2 MULTI THREADING }
➢ We cannot guarantee which thread is
executed first
➢ Multithreading is the process of ➢ Thread scheduler decides it based on
executing more than one thread at a optimality
time. ADVANTAGES OF MULTI-THREADING:-
➢ Each thread performs a specific task ➢ More than one task executed
➢ All the threads run simultaneously simultaneously
➢ OS divides the processing time among ➢ Time saving and efficient
each thread ➢ Quicker execution
➢ Thereby the available CPU resources ➢ Less memory space occupied by each
are optimally used when a computer thread
has multiple CPUs. ➢ It is useful in developing Gaming
➢ Performing multiple activities in a applications, graphics
program concurrently is called
multithreading.
EXAMPLE MULTI THREADING PROGRAM
class class1 extends Thread
{ IO STREAM
public void run()
{ ➢ A stream is defined as a continuous
System.out.print("onet flow of objects sequentially.
ask"); ➢ In Java, A stream is defined as a
} channel on which data flow from
} sender to receiver
class class2 extends Thread ➢ Categories: Input stream and output
{ stream
public void run() ➢ java.io package contains all the classes
{ required for input and output
System.out.print("twot operations.
ask")
➢ Input Stream: Input stream is defined public static void main(String bala[ ] )
as an object that reads a stream of {
data from a file int n;
➢ Output Stream: Output stream is try
defined as an object that writes {
stream of data to a file InputStream is = new
➢ Nature of stream: Byte Stream and FileInputStream("bala.txt");
character stream System.out.println("Total
Byte Stream Bytes = "+(n=is.available()));
➢ To give input and get output in bytes for(int i = 0; i <n; i++)
➢ Super classes available: InputStream, System.out.println((char)is.rea
OutputStream d());
➢ Methods: read(), write() is.close();
InputStream classes OutputStream classes }
FileInputStream FileOuputStream catch(FileNotFoundException
PipedInputStream PipedOuputStream e1)
FilterInputStream FilterOuputStream {
ByteArrayInputStrea ByteArrayOuputStream System.out.print(e1);
m }
catch(IOException e2)
{
System.out.print(e2);
}
}
}
O/p:-
Total bytes = 20
➢ This is the file content from bala.txt
Character Stream BufferedInputStream and
➢ To give input and get output in BufferedOutputStream classes
character ➢ It is preferred over other streams for
➢ Super classes available: Reader, Writer R/W operations
➢ Methods: read(), write() ➢ It is more efficient in handling files
Classes in Reader Classes in Writer ➢ All their methods are extended from
FileReader FileWriter InputStream and OutputStream class
PipeReader PipeWriter which are their parents.
FilterReader FilterWriter ➢ We can specify buffer size (default
ByteArrayreader ByteArrayWriter size = 512 bytes)
➢
Example for FileInputStream and import java.io.*;
FileOutputStream classes class buf
import java.io.*; {
class fis public static void main(String bala[ ] )
{
{
try Uses: To perform arithmetic operations,
{ display graphics, play sounds, display videos,
DataOutputStream dos = new etc
DataOutputStream(new Situations for applet usage:-
BufferedOutputStream(new ➢ To display dynamic web pages
FileOutputStream("bala.txt"))) ➢ To display special effects
; (Audio/Video)
dos.writeUTF("Bala"); ➢ To transfer an application to a user
dos.writeDouble(12345.67); who is located remotely
dos.writeInt(1234); Life Cycle of an Applet:
dos.writeChar('s');
Four methods in the Applet class give you the
dos.close();
framework on which you build any serious
DataInputStream dis = new
applet:
DataInputStream(new
BufferedInputStream(new
FileInputStream("bala.txt"));
System.out.println(dis.readUTF
());
System.out.println(dis.readDo
uble());
System.out.println(dis.readInt(
));
System.out.println(dis.readCha
r()); ➢ init: This method is intended for
} whatever initialization is needed
catch(FileNotFoundException e1) for your applet.
{ ➢
System.out.print(e1); ➢ start: This method is automatically
} called after the browser calls the init
catch(IOException e2) method.
{ ➢
System.out.print(e2); ➢ stop: This method is automatically
} called when the user moves off the
} page on which the applet sits.
} ➢
➢ destroy: This method is only
APPLET called when the browser shuts
➢ Applets are small Java programs that down normally.
can be used in internet
➢ They can be transferred over internet ➢ paint: Invoked immediately after the
from one PC to another, displayed on start() method, and also any time the
Java enabled web browsers applet needs to repaint itself in the
➢ Classes
➢ Method
➢ Inner class in java is defined as a
➢ Message Parsing class within another class
➢ They are also called as nested class
Object Any entity that has state and
Behavior is known as an object. For SYNTAX OF INNER CLASS
example: chair, pen, table, keyboard, bike Class one
etc. It can be physical and logical. {
Class Collection of objects is called class. It is Class two
a logical entity. {
-------
Inheritance When one object acquires all -------
the properties and behaviours of parent }
object i.e. known as inheritance. It provides }
code reusability. It is used to achieve
runtime polymorphism.
Polymorphism When one task is performed
by different ways i.e. known as
polymorphism. For example: to convense
the customer differently, to draw something
e.g. shape or rectangle etc. In java, we use
method overloading and method overriding
to achieve polymorphism. Another example
can be to speak something e.g. cat speaks
meaw, dog barks woof etc.
Static inner class
Abstraction Hiding internal details and ➢ They are the static members of
showing functionality is known as another class
abstraction. For example: phone call, we ➢ Static keyword is present before the
don't know the internal processing. In java, inner class
we use abstract class and interface to ➢ Static member of outer class are
achieve abstraction. visible to static inner class
➢ Non static members of outer lass are
Encapsulation Binding (or wrapping) code
invisible to static inner class
and data together into a single unit is known
EXAMPLE PROGRAM FOR STATIC INNER
as encapsulation. For example: capsule, it is
CLASS
wrapped with different medicines. A java
class outer
class is the example of encapsulation. Java
{
bean is the fully encapsulated class because
static class inner
all the data members are private here.
{
15.How does a radio button in java differ 9 Discuss the different models of Threads and
from a check box? their states.
16.Why do you need run () and start () 10 Design and Write a Java Program using
method both. Applets
17.What is a Stream? Which class allows you
to read objects directly from a stream?
18.What is Polymorphism in Java? Explain
how Polymorphism is supported in Java?
19.Mention the subclasses of the AWT Event
class.
20.Code a Graphics method in Java to draw
the String “Hello World” from the
coordinates (100,200).
IMPORTANT 16 MARKS QUESTION:
1 Explain the features and structure of Java
Program.
2 Explain about Inheritance and Interfaces in
Java.
3 Show how compile- time and run- time
polymorphism are achieved in Java? Explain
with examples.
4 Explain about Packages and Abstract classes
in Java.
5 Explain about Applet Lifecycle? How Applets
are prepared and executed?
6 List and discuss the role of String and String
Buffer classes used in Java.
7 What are the different input and output
streams and their classes? Explain with
Examples?
8 Discuss about Exception handling in Java
with suitable examples.
Facebook Upload/download/view
micro contents WEBSITE
Twitter Upload/doenload/view
thoughts A collection of web pages which are
grouped together and usually connected
2.2.3 ADVANTAGES OF together in various ways. Often called a
COLLABORATION TOOLS "web site" or simply a "site."
➢ Reliable
2.4.6 PROTOCOLS USED IN ➢ Heavy weight protocol
INTERNET ➢ Handshaking mechanism available
➢ Error control, flow control, congestion
FTP (File transfer Protocol) control mechanisms
➢ FTP is used to share files among the ➢ Complex, tough to implement
computers in the LAN ➢ Ex: Telnet, SMTP, FTP, e-mail, SSH, HTTP,
➢ It uses two connections (data HTTPS
transfer and control)
➢ FTP data transfer connection uses POP3 (Post Office Protocol Version 3)
port 20 ➢ It is used by local email client
➢ FTP control connection uses port 21 ➢ It uses port no 110
➢ Some familiar commands in FTP are: ➢ Popo3 protocol works only at the
USER, PASS, QUIT, CWD, DELE, LIST, receivers end
RETR, STOR, HELP ➢ The client can receive the emails from the
mailbox
HTTP (Hyper Text Transfer protocol)
➢ Hyper Text Transfer protocol (HTTP) is a UDP(User Datagram Protocol)
stateless protocol for communication, to ➢ Connectionless protocol
transfer information on LAN and WWW ➢ Used for simply transmission of data
➢ It is used to deliver files virtually and ➢ It is an unreliable protocol
other data on WWW
➢ It takes place through TCP/IP sockets DIFFERENCE BETWEEN TCP AND UDP
➢ A browser is a HTTP client – sends HTTP TCP UDP
request Connection oriented Connection less
➢ A web server is a HTTP server – sends (link between the
HTTP reply packets)
➢ It uses port no: 80 (HTTP servers listen to ACK is available No ACK
this port) Reliable Unreliable
Heavy weight protocol Light weight protocol
SNMP (Simple Network Management Handshaking mechanism No handshaking concept
protocol) Error control, flow No control mechanism
➢ It is used to manage a network such as its control, congestion
participants, etc control, etc
➢ Types of participants: Supervisors, Agents Complex, tough to Simple, easy to
➢ SNMP make use of UDP connection for implement implement
transferring the SNMP message Ex: Telnet, SMTP, FTP, e- Ex: VoIP, DHCP, DNS, RIP,
mail, SSH, HTTP, HTTP, SNMP
HTTPS
TCP (Transmission Control Protocol ) POSSIBLE QUESTIONS FROM
➢ Connection oriented (link between the INTERNET
packets)
2 marks
➢ ACK is available
16 marks
2.8.1 HTML 5 1. Explain basic HTML tags[NOV/DEC
2017]
➢ HTML stands for Hyper Text Mark-up 2. Explain Box model
Language 3. Explain about two types of list and
➢ It is used to organize text, graphics, frame set[NOV/ DEC 2017]
audio, video on a web page
<table>
<tr> 2.9.2 HTML FRAMES
<th>……</th>
</tr>
SYNTAX OF FRAME
<frameset >
<frame src="top.htm" name="top"/>
</frameset>
EXAMPLE PROGRAM
<!DOCTYPE html>
<html> <!DOCTYPE >
<head> <html lang="en">
<title>HTML Frames</title> <head>
</head> <title>CSS Box Model Example</title>
<frameset rows="16%,84%"/> <style type="text/css">
<frame src="top.htm" name="top"/> .example1 {
<frameset cols="50%,50%"/> width:220px;
<frame src="left.htm" name="left"/> background-color: yellow;
<frame src="right.htm" name="right"/> }
</frameset> .example2 {
</frameset> width:220px;
</html> background-color: yellow;
O/P: margin:40px;
}
top </style>
</head>
left right <body>
<h1>Box Model Example</h1>
<hr style="width: 100%; height: 1px;">
<p class="example1">My Content
2.9.3 BOX MODEL Example 1</p>
➢ The CSS box model is essentially a box that <hr style="width: 100%; height: 1px;
wraps around HTML elements, and it color: blue;">
consists of: margins, borders, padding, and <p class="example2">My Content
the actual content. Example 2</p>
➢ The different parts are: </body>
</html>
✓ File Select boxes
O/P:
✓ Hidden Controls
Box Model Example
✓ Clickable Buttons
✓ Submit and Reset Button
My Content Example 1
The HTML <form> tag is used to create
an HTML form and it has following syntax –
PROGRAM
<!DOCTYPE html>
<html>
<head>
<title>Radio Box Control</title>
</head>
2.9.4.3 CHECK BOXCONTROL <body>
➢ Checkboxes are used when more than <form>
one option is required to be selected. <input type = "radio" name = "subject"
➢ They are also created using HTML <input> value = "maths"> Maths
tag but type attribute is set to checkbox.. <input type = "radio" name = "subject"
value = "physics"> Physics
</form>
</body>
Maths Physics
PROGRAM
<!DOCTYPE html>
2.9.4.5 SELECT BOX CONTROL
<html>
<head>
➢ A select box, also called drop down box
<title>File Upload Box</title>
➢ which provides option to list down various
</head>
options in the form of drop down list,
from where a user can select one or more
<body>
options.
<form>
<input type = "file" name =
PROGRAM
<!DOCTYPE html> "fileupload" accept = "image/*" />
<html>
</form>
</body>
<head>
</htm>
<title>Select Box Control</title>
</head>
2.9.5 HTML LISTS
<body>
<form> HTML offers web authors three ways for
<select name = "dropdown"> specifying lists of information. All lists must
<option value = "Maths" contain one or more list elements. Lists may
selected>Maths</option> contain −
<option value =
"Physics">Physics</option> ➢ <ul> − An unordered list. This will list
</select> items using plain bullets.
</form> ➢ <ol> − An ordered list. This will use
</body> different schemes of numbers to list
your items.
</html> ➢ <dl> − A definition list. This arranges
O/P: your items in the same way as they
Maths
are arranged in a dictionary.
<html>
➢ An unordered list is a collection of related
items that have no special order or <head>
<title>HTML Ordered List</title>
sequence.
</head>
➢ This list is created by using
<body>
HTML <ul> tag. Each item in the list is
<ol>
marked with a bullet. <li>Beetroot</li>
<li>Ginger</li>
PROGRAM
<li>Potato</li>
<!DOCTYPE html>
<li>Radish</li>
<html>
</ol>
</body>
<head>
</html>
<title>HTML Unordered List</title>
</head>
O/P:
<body>
<ul>
2. Beetroot
<li>Beetroot</li>
3. Ginger
<li>Ginger</li>
4. Potato
<li>Potato</li>
5. Radish
<li>Radish</li>
</ul>
2.9.5.3 HTML DEFINITION LISTS
</body>
</html> ➢ HTML and XHTML supports a list style
O/P:
which is called definition lists where
• Beetroot entries are listed like in a dictionary
• Ginger
or encyclopedia.
• Potato
• Radish ➢ The definition list is the ideal way to
present a glossary, list of terms, or
2.9.5.2 HTML ORDERED LISTS
➢ If you are required to put your items in a other name/value list.
numbered list instead of bulleted, then
HTML ordered list will be used. Definition List makes use of following three
➢ This list is created by using <ol> tag.
tags.
➢ The numbering starts at one and is
incremented by one for each successive
ordered list element tagged with <li>. • <dl> − Defines the start of the list
</BODY> </body>
</HTML> </html>
O/P
O/P : INLINE CSS
POSSIBLE QUESTIONS FROM CSS
CLASS SELECTOR 1 2 marks
CLASS SELECTOR 2 1.Define CSS
16 marks
2.10.4 EXAMPLE FOR EXTERNAL STYLE 1. Explain CSS [NOV/DEC 2017 &
SHEET APRIL/MAY 2015 & NOV/DEC 2016]
EXTERNALCSS.HTML
<HTML>
<HEAD>
<LINK REL="STYLESHEET
TYPE="TEXT/CSS" HREF="EX.CSS">
</HEAD>
2.11 WEB 2.0
<BODY>
➢ Internet has revolutionized the computer
<P CLASS="FORMAT">FORMATTING</P>
and communications, undergoing extreme
<P CLASS="WEIGHT">WEIGHT</P>
make-over
</BODY>
➢ In 1990s, it was used to retrieve
</HTML>
information (Read-Only)
EX.CSS
➢ Around 2004, new web tools came up, to
P.FORMAT
add contents to web
{
➢ People with no programming knowledge
FONT-FAMILY:ARIAL;
can publish an article, photo, video, ppt,
FONT-SIZE:25PX;
pdf, etc.
}
➢ Web has become 2-way communication
P.WEIGHT
medium (R/W)
{
➢ This is called Web 2.0 (bidirectional data
FONT-WEIGHT:BOLD;
traffic)
FONT-STYLE:ITALIC;
➢ It is not the second version of Web
}
➢ It is also called Participatory web (or)
O/P :
Read/Write Web
FORMATTING
➢ Web 2.0 refers to the transition of static
WEIGHT
HTML pages to dynamic web
2.10.5 EXAMPLE FOR INLINE STYLE ➢ XML is used
SHEET ➢ It offers freedom for everybody to
<html> contribute to the web
<head> ➢ Ex: Wikipedia, FB, YouTube, Twitter, etc.
</head>
<body> 2.10.1COMPONENTS OF WEB 2.0
<h2>INLINE CSS</h2>
➢ Blogs
➢ Wikis
➢ Web services
1.2DOM MODEL
➢ Document Object Model (DOM) is a
set of platform independent and language
neutral application interface (API)
➢ Its describes how to access and
manipulate the information stored in XML,
XHTML and javascript documents.
<script type="text/javascript">
Method Description function printvalue()
{
write("string") writes the given string on the var name=document.form1.name.value;
doucment.
alert("Welcome: "+name);
writeln("string writes the given string on the
}
") doucment with newline
character at the end. </script>
If(x>0)
3.5.1 THE TRY...CATCH...FINALLY
Document.write(“the word is
found at”+x); STATEMENT
➢ The latest versions of JavaScript added
else
exception handling capabilities.
document.write(“not found”);
3.6 VALIDATION
SYNTAX
➢ JavaScript, provides a way to validate
<script type="text/javascript"> form's data on the client's computer
<!-- before sending it to the web server.
➢ Form validation generally performs two
try
functions.
{ ✓ Basic Validation − First of all, the
} form must be checked to make
sure all the mandatory fields are
catch ( e )
filled in.
{
✓ Data Format Validation −
} Secondly, the data that is entered
finally must be checked for correct form
and value.
{
} VALIDATION EXAMPLE PROGRAM
//--> <html>
</script> <body>
EXAMPLE PROGRAM <script>
<!DOCTYPE html>
function validateform(){
<html>
<body> var name=document.myform.name.value;
<p id="demo"></p>
<script> var
try password=document.myform.password.value
{ ;
adddlert("Welcome guest!");
if (name==null || name==""){
}
catch(err) alert("Name can't be blank");
{
document.getElementById("demo"); return false;
innerHTML = err.message;
</script> </script>
</body>
</body>
</html> </html>
O/P O/P
Infinity 10
3.7.2 MATH OBJECT 3.7.3 DATE OBJECTS
➢ The JavaScript Math object is ➢ The JavaScript Date object provides a
used to perform mathematical functions. way to work with dates and times.
SYNTAX
SYNTAX
➢ commonly used methods from math ➢ commonly used methods from date
object object
✓ sqrt(num) ➢ getDate
✓ abs(num) ➢ getDay
✓ ceil(num) ➢ getFullYear
✓ floor(num) ➢ getHours
✓ log(num) ➢ getMilliseconds
✓ pow(a,b) ➢ getMinutes
➢ getMonth
EXAMPLE PROGRAM ➢ getSeconds
➢ getTime
<!DOCTYPE html PUBLIC “-//W3C//DTD ➢ getTimezoneOffset
XHTML 1.0 Transitional//EN”
http://www.w3.org/1999/xhtml11.dtd>
EXAMPLE PROGRAM
<html xmlns =
http://www.w3.org/1999/xhtml> <!DOCTYPE html PUBLIC “-
//W3C//DTD XHTML 1.0
<head> Transitional//EN”
</head> http://www.w3.org/1999/xhtml11.dt
d>
<body>
<html xmlns =
<script type=”text/javascript”> http://www.w3.org/1999/xhtml>
Var num=100; <head>
Document.write(Math.surt(num)); </head>
<body> <body>
<script type=”text/javascript”>
<script type=”text/javascript”>
Var temp = new Boolean(false);
Var my_date = new Date(); Document.write(false);
Document.write(my_date.getDate()); </script>
</body>
Document.write(my_date.getHours());
</html>
Document.write(my_date.getSeconds(
)); O/P
</script> false
</body>
</html> 3.8 EVENT HANDLING
➢ An event handler executes a segment of a
O/P code based on certain events occurring
18 within the application
5 ➢ JavaScript event handers can be divided
32 into two parts:
✓ interactive event handlers
3.7.4 BOOLEAN OBJECT ✓ non-interactive event handlers.
➢ The Boolean object is necessary when ➢ An interactive event handler is the one
attempting to create any sort of logic in that depends on the user interactivity
JavaScript. with the form or the document. For
➢ A Boolean is an object that represents a true example, onMouseOver
or a false value. ➢ non-interactive event handler would be
onLoad, because this event handler would
SYNTAX
automatically execute JavaScript code
var myBoolean = true; ➢ following event handlers available in
EXAMPLE PROGRAM JavaScript
</head> </head>
<body> <body>
</html> </form>
O/P </body>
{ HTML DHTML
Hypertext Markup Dynamic HTML
var input=0;
Language
input=document.myform.data.value; Static web pages Dynamic web pages
It works slowly upon It works faster on
alert("you have changed the value from 10 to client-server client-server
" + input ); technology technology
No CSS, and no Use CSS, events,
}
dynamic contents methods to create
</script> dynamic pages
No processing at Script is processed at
</head> browser browser
<body> Contents will not be Contents can be
changed changed
<input type="text" name="data" value="10" Simple, less Complex, more
size=10 on change="valid(this.form)"> interactive interactive
</form> Only HTML contents DHTML =
HTML+CSS+JS
</body>
</html>
3.10 SERVLET
O/P
➢ Servlets are defined as simple java programs
You have changed the value from 10 to 0
that are dynamically loaded and run on JVM
of web servers, to respond to the requests
3.9 DHTML WITH JAVASCRIPT from the clients
➢ It acts as middle layer between browser and
server
➢ DHTML stands for Dynamic HTML
➢ To develop sites with secure access, interact
➢ DHTML is NOT a language or a web
with DB, maintain unique session info of each
standard.
client
➢ DHTML is a TERM used to describe the
➢ Used with HTTP, hence called HttpServlet
technologies used to make web pages
➢ It makes use of two packages:
dynamic and interactive.
✓ Javax.servlet
➢ To most people DHTML means the
combination of HTML, JavaScript, DOM,
and CSS.
SERVLET CONTAINER
➢ The server that executes a servlet is called as
servlet container or servlet engine
3.9.1 DIFFERENCE BETWEEN HTML AND ➢ Browsers send an HTTP request to server,
DHTML which in turn sends to servlet container
➢ Servlet container receives the request from
the server, processes appropriate servlet,
✓ javax.servlet.http
EXAMPLE PROGRAM
HTML PROGRAM {
Login.html PrintWriter out = resp.getWriter();
<html> out.println("<html><body>");
<body> out.println(msg);
<form action="login" method="get"> out.println("</body></html>");
<table> }
<tr> <td>User</td> <td><input }
name="user" /></td> </tr> <tr> ➢ We compilate this Servlet and we include
<td>password</td> <td><input name="password" LoginServlet.class in the folder /WEB-
/></td> </tr> INF/classes. We modify web.xml to link
</table> /login with this Servlet.
<input type="submit" />
</form>
</body> WEB.XML
</html>
➢ create a Servlet which receives the request <web-app>
in /login , which is the indicated direction in <servlet>
the action attribute of the tag <form> of <servlet-name>hello</servlet-name>
login.html <servlet-class> hello </servlet-class>
SERVLET PROGRAM </servlet>
import java.io.*; <servlet-mapping> <servlet-name>login-
import javax.servlet.*; servlet</servlet-name> <url-pattern>/login</url-
import javax.servlet.http.*; pattern>
public class LoginServlet extends HttpServlet </servlet-mapping>
{ </web-app>
protected void doGet(HttpServletRequest req,
HttpServletResponse resp) throws O/P
ServletException, IOException
{
String user = req.getParameter("user");
String pass = req.getParameter("password");
if ("balamurugan".equals(user) &&
"bala1234".equals(pass))
{
response(resp, "login ok");
}
else
{
response(resp, "invalid login");
}
}
private void response(HttpServletResponse resp,
String msg) throws IOException 3.11.3 HTTP POST
SERVLET PROGRAM
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class LoginServlet extends
HttpServlet
3.12 SESSION HANDLING
{
protected void
➢ Session simply means a particular interval
doPost(HttpServletRequest req, of time.
HttpServletResponse resp) throws ➢ Session Tracking is a way to maintain
ServletException, IOException state (data) of an user. It is also known
{ as session management in servlet.
String user = req.getParameter("user"); ➢ Http protocol is a stateless so we need to
String pass = maintain state using session tracking
techniques.
req.getParameter("password");
Advantage of Cookies
1. Simplest technique of maintaining the state.
2. Cookies are maintained at client side.
Disadvantage of Cookies
1. It will not work if cookie is disabled from the
browser.
2. Only textual information can be set in Cookie
object.
3.12.1 Session Tracking Techniques
Gmail uses cookie technique for login. If you disable
There are four techniques used in
Session tracking:
the cookie, gmail won't work.
Hidden Form Fields
1. Cookies
3. URL Rewriting
4. HttpSession
out.println("<tr><td>Time of Last
Types of Cookie
Access</td><td> + lastAccessTime+ There are 2 types of cookies in servlets.
</td></tr>"); 1. Non-persistent cookie
2. Persistent cookie
out.println("<tr><td>User ID</td><td> +
Advantage of Cookies
userID+ </td></tr>"); 1. Simplest technique of maintaining the state.
2. Cookies are maintained at client side.
out.println("<tr><td>Number of
visits</td><td> + visitCount+ </td></tr>"); Disadvantage of Cookies
1. It will not work if cookie is disabled from the
browser.
out.println("</table></body></html>"); 2. Only textual information can be set in Cookie
object.
}
Gmail uses cookie technique for login. If you disable
} the cookie, gmail won't work.
Hidden Form Fields
O/P
<html>
3.13 COOKIES
➢ By default, each request is considered as a <head>
new request.
➢ In cookies technique, we add cookie with <title>Cookies Example in Servlets</title>
response from the servlet.
</head>
➢ So cookie is stored in the cache of the
browser.
➢ After that if request is sent by the user,
cookie is added with request by default. <body bgcolor=wheat>
Thus, we recognize the user as the old
user.
<center> {
<h1>Cookies Example in Java</h1> String fname=req.getParameter("fname");
String lname=req.getParameter("lname");
<form
action="http://localhost:8080/cookies/co"
Cookie f=new Cookie("first_name",fname);
method="Post">
Cookie l=new Cookie("last_name",lname);
First name: <input type="text"
name="fname">
Last name: <input type="text" res.addCookie(f);
name="lname">
res.addCookie(l);
<input type="submit"value="SUBMIT">
</form>
res.sendRedirect("http://localhost:8080/cook
ies/st");
</center>
}
}
</body>
GETCOOKIE.JAVA
import javax.servlet.*;
</html>
import javax.servlet.http.*;
3.13.2 SERVLET PROGRAMS
import java.io.*;
COOKIEEXAMPLE.JAVA
public class GetCookie extends HttpServlet
import javax.servlet.*;
{
import javax.servlet.http.*;
public void doGet(HttpServletRequest
import java.io.*; req,HttpServletResponse res) throws
public class CookieExample extends ServletException,IOException
HttpServlet {
{ PrintWriter pw=res.getWriter();
public void doPost(HttpServletRequest
req,HttpServletResponse res) throws
ServletException,IOException pw.println("<h1>");
Go to
http://tomcat.apache.org/download-
70.cgi then go to the Binary
Distribution/Core/ and download the
"zip" package
Step 2
<param-value>true</param-value> like:
In that we set reloadable="true" to the
<Context> element to enable automatic
Step 4(b) "conf\server.xml file"; set the
reload after code changes.
TCP Port Number
Add reloadable="true" as in the following:
<Context reloadable="true">
......
</Context> Like
Step 5
Locate the following lines, and change
port="8080" to port="9999". Like:
Now, start the tomcat server
<Connector port="9999"
Executable programs and scripts are kept
protocol="HTTP/1.1" Like
in the "bin" sub-directory of the Tomcat
Step 4(c) "conf\context.xml"; Enabling
installed directory, e.g.,
Automatic Reload
"E:\myserver\tomcat7.0.40\bin".
Step 5(a)
3.15 JDBC
➢ JDBC is defined as an API that provides
industry standard and database
connectivity between java apps and
database servers
➢ It is a framework that contains many
classes, interfaces, exceptions, using
which java apps can send SQL statement
to database to store and retrieve data
Uses
➢ It helps client to store and retrieve data
to databases
3.15.2 COMMON JDBC COMPONENTS
➢ It helps client to update databases
Types The JDBC API provides the following
➢ JDBC-ODBC bridge driver interfaces and classes −
➢ Partial java driver ➢ DriverManager: This class manages a list of
➢ Pure java driver for accessing database drivers. establish a database
Connection.
middleware ➢ Driver: This interface handles the
➢ Pure java driver for direct DB access communications with the database server.
You will interact directly with Driver objects
3.15.1 JDBC ARCHITECTURE very rarely.
➢ Connection: This interface with all methods
The JDBC API supports both two-tier and
for contacting a database. The connection
three-tier processing models for database
object represents communication context, i.e.,
access but in general, JDBC Architecture
all communication with database is through
consists of two layers −
connection object only.
➢ JDBC API: This provides the application-
➢ Statement: You use objects created from this
to-JDBC Manager connection.
interface to submit the SQL statements to
➢ JDBC Driver API: This supports the JDBC
the database.
Manager-to-Driver Connection. ➢ ResultSet: These objects hold data retrieved
from a database after you execute an SQL
➢ The JDBC API uses a driver manager and query using Statement objects.
database-specific drivers to provide ➢ SQLException: This class handles any errors
transparent connectivity to heterogeneous that occur in a database application.
databases. ➢ Structured Query Language (SQL) is a
Following is the architectural diagram, standardized language that allows you to
which shows the location of the driver perform operations on a database, such as
creating entries, reading content, updating
manager with respect to the JDBC drivers
content, and deleting entries.
and the Java application ➢ SQL is supported by almost any database you
will likely use, and it allows you to write SQL> SELECT column_name, column_name, ...
database code independently of the FROM table_name
underlying database. Example
➢ Create Database The following SQL statement selects the age,
The CREATE DATABASE statement is used for first and last columns from the Employees
creating a new database. The syntax is − table, where id column is 100 −
CREATE DATABASE DATABASE_NAME; SQL> SELECT first, last, age
Example FROM Employees
The following SQL statement creates a WHERE id = 100;
Database named EMP − ➢ UPDATE Data
CREATE DATABASE EMP; The UPDATE statement is used to update data.
➢ Drop Database The syntax for UPDATE is −
The DROP DATABASE statement is used for SQL> UPDATE table_name
deleting an existing database. The syntax is − SET column_name = value, column_name =
SQL> DROP DATABASE DATABASE_NAME; value, ...
Note: To create or drop a database you should Example
have administrator privilege on your database The following SQL UPDATE statement changes
server. Be careful, deleting a database would the age column of the employee whose id is
loss all the data stored in the database. 100 −
The DROP TABLE statement is used for SQL> UPDATE Employees SET age=20 WHERE
deleting an existing table. The syntax is − id=100;
DROP TABLE table_name; DELETE Data
Example The DELETE statement is used to delete data
The following SQL statement deletes a table from tables. The syntax for DELETE is −
named Employees − SQL> DELETE FROM table_name WHERE
DROP TABLE Employees; conditions;
➢ INSERT Data SQL> DELETE FROM Employees WHERE
id=100;
The syntax for INSERT, looks similar to the 3.15.3 BUILDING A JDBC
following, where column1, column2, and so on
represents the new data to appear in the ➢ Import the packages: Requires that you
respective columns − include the packages containing the JDBC
SQL> INSERT INTO table_name VALUES classes needed for database programming.
(column1, column2, ...); Most often, using import java.sql.* will suffice.
Example ➢ Register the JDBC driver: Requires that you
The following SQL INSERT statement inserts a initialize a driver so you can open a
new row in the Employees database created communication channel with the database.
earlier − ➢ Open a connection: Requires using the
SQL> INSERT INTO Employees VALUES (100, DriverManager.getConnection() method to
18, 'Zara', 'Ali'); create a Connection object, which represents
➢ SELECT Data a physical connection with the database.
The SELECT statement is used to retrieve data ➢ Execute a query: Requires using an object of
from a database. The syntax for SELECT is − type Statement for building and submitting an
ID: 101, Age: 25, First: Mahnaz, Last: Fatma JSP makes use of No custom tags
ID: 102, Age: 30, First: Zaid, Last: Khan custom tags
ID: 103, Age: 28, First: Sumit, Last: Mittal
3.16.1 ARCHITECTURE
3.17 JSTL
➢ Java Standard Tags Library represents set of
tags to simplify JSP development
<%@ taglib
uri="http://java.sun.com/jsp/jstl/core" prefix="c"
%>
<head> <title>fmt:formatDate</title>
</head>
<body>
<h2>Different Formats of the
Date</h2>
<c:set var="Date" value="<%=new
java.util.Date()%>" />
JSTL Formatting tags <p> Formatted Time :
➢ The formatting tags provide support for <fmt:formatDate type="time"
message formatting, number and date value="${Date}" />
formatting etc. </p>
➢ The url for the formatting tags is <p> Formatted Date :
http://java.sun.com/jsp/jstl/fmt and <fmt:formatDate type="date"
prefix is fmt. value="${Date}" />
➢ The JSTL formatting tags are used for </p>
internationalized web sites to display and <p> Formatted Date and Time :
format text, the time, the date and <fmt:formatDate type="both"
numbers. value="${Date}" />
<%@ taglib </p>
uri="http://java.sun.com/jsp/jstl/fmt" </body></html>
prefix="fmt" %> Formatting Tags
Descriptions fmt:timeZone
It specifies a parsing action nested in its
body or the time zone for any time
formatting. fmt:formatNumber
It is used to format the numerical value
JSTL XML tags
with specific format or precision.
➢ The JSTL XML tags are used for providing a
fmt:parseDate
JSP-centric way of manipulating and
It parses the string representation of a
creating XML documents.
time and date. fmt:formatDate
➢ XML Tags Descriptions x:out
It formats the time and/or date using the
Similar to <%= ... > tag, but for XPath
supplied pattern and styles.
expressions.
<%@ taglib prefix="c"
➢ x:parser It is used for parse the XML data
uri="http://java.sun.com/jsp/jstl/core"%>
specified either in the tag body or an
<%@ taglib prefix="fmt"
attribute.
uri="http://java.sun.com/jsp/jstl/fmt"%>
➢ x:set
<html>
<%@ taglib
uri="http://java.sun.com/jsp/jstl/core"
prefix="c"%>
<%@ taglib
uri="http://java.sun.com/jsp/jstl/sql"
prefix="sql"%>
<html>
<body>
<sql:setDataSource var="db"
driver="com.mysql.jdbc.Driver" 3.18 CREATING HTML FORMS BY
url="jdbc:mysql://localhost/test" EMBEDDING JSP CODE
user="root" password="1234"/>
<sql:query dataSource="${db}" var="rs">
SELECT * from Students; JSP Scripting elements
</sql:query> ➢ Scripting elements provides the ability to
<table border="2" width="100%"> insert java code inside the jsp.
<tr> ✓ scriptlet tag
<th>Student ID</th> ✓ expression tag
<th>First Name</th> ✓ declaration tag
<th>Last Name</th>
<th>Age</th> 3.18.1 JSP SCRIPTLET TAG
</tr> A scriptlet tag is used to execute java source
<c:forEach var="table" code in JSP
items="${rs.rows}">
<tr> Example
<td><c:out value="${table.id}"/></td> In this example, we have created two files
<td><c:out index.html and welcome.jsp. The index.html
value="${table.First_Name}"/></td> file gets the username from the user and the
<td><c:out welcome.jsp file prints the username with the
value="${table.Last_Name}"/></td> welcome message.
<td><c:out value="${table.Age}"/></td> File: index.html
</tr>
</c:forEach> <html>
</table> <body>
</body></html>
<form action="welcome.jsp">
O/P
<input type="text" name="uname">
SYNTAX
If(condition)
{ }
else
VELTECH HIGHTECH DR.RANGARAJAN Dr.SAKUNTHALA ENGINEERING COLLEGE Page 71
VELTECH HIGHTECH Dr.RANGARAJAN Dr.SAKUNTHALA ENGINEERING COLLEGE DEPARTMENT
OF COMPUTER SCIENCE AND ENGINEERING
case "red":
echo "Your favorite color is red!";
break;
case "green":
echo "Your favorite color is green!";
break;
default:
echo "Your favorite color is
neither red, blue, nor green!";
?>
</body>
</html>
SYNTAX
O/P
Switch(condition)
Your favorite color is green!
{
Case : 4.5 BUILT IN FUNCTIONS
…………. ➢ PHP functions are similar to other
programming languages.
……… ➢ A function is a piece of code which takes
default : one more input in the form of parameter
and does some processing and returns a
}
value.
EXAMPLE PROGRAM ➢ PHP has more than 1000 built-in
<head> functions.
➢ Two types of function
</head> ✓ User define function
<body> ✓ Built in function
SYNTAX
<?php
function name_of_function(parameter)
$fav = "green"; {
………………
switch ($fav)
}
{
VELTECH HIGHTECH DR.RANGARAJAN Dr.SAKUNTHALA ENGINEERING COLLEGE Page 73
VELTECH HIGHTECH Dr.RANGARAJAN Dr.SAKUNTHALA ENGINEERING COLLEGE DEPARTMENT
OF COMPUTER SCIENCE AND ENGINEERING
<?php
$num = 4.6 CONNECTING TO DATABASE
cal_days_in_month(CAL_GREGORIAN,10, ➢ Before you can get content out of your
2016); MySQL database, you must know how to
echo "There are $num days in October 2016"; establish a connection to MySQL from
?> inside a PHP script.
O/p:- ➢ To perform basic queries from within
There are 31 days in October 2016 MySQL is very easy.
➢ The first thing to do is connect to the
CHARACTER FUNCTIONS database. The function to connect to
➢ The functions provided by this extension MySQL is called mysql_connect.
check whether a character or string falls ➢ This function returns a resource which is
a pointer to the database connection.
into a certain character class according to
the current locale. <?php
➢ Checks if all of the characters in the $username = "your_name";
provided string, text, are alphabetical. $password = "your_password";
Checks if all of the characters in the $hostname = "localhost"; //connection to the
provided string, text, are numerical. It database $dbhandle =
mysql_connect($hostname, $username,
checks only 1...9
$password) or die("Unable to connect to
MySQL");
echo "Connected to MySQL<br>";
4.7.1 CREATE COOKIES WITH PHP ➢ For example, it can be used to verify
whether the format of data i.e. name,
➢ A cookie is created with the
email, phone number, etc.
setcookie() function.
➢ PHP (version 5.3 and above) supports
Syntax Perl style regular expressions via its preg_
setcookie(name, value, expire, path, family of functions.
domain, secure, httponly);
4.8.1 REGULAR EXPRESSION FUNCTION
➢ Only the name parameter is required.
All other parameters are optional. Function What it Does
preg_match() Perform a regular expression
match.
EXAMPLE PROGRAM preg_match_all Perform a global regular
<html> expression match.
<body> preg_replace() Perform a regular expression
<?php search and replace.
if(!isset(“Myname”])) preg_grep() Returns the elements of the
echo "welcome input array that matched the
“.$+COOKIE[“Myname”]”; . $else pattern.
“welcome guest”; preg_split() Splits up a string into
?> substrings using a regular
expression.
</body> preg_quote() Quote regular expression
characters found within a
</html> string.
O/P
4.8.2 Regular Expression Syntax
Welcome cse
Regular expression syntax includes the use of
special characters (do not confuse with
4.8 REGULAR EXPRESSION
the HTML special characters). The characters
➢ Regular Expressions, commonly known as that are given special meaning within a
"regex" or "RegExp", are a specially regular expression, are: . * ? + [ ] ( ) { } ^ $ | \.
formatted text strings used to find
patterns in text. EXAMPLE PROGRAM
➢ Regular expressions are one of the most
powerful tools available today for <?php
effective and efficient text processing and $pattern = "/ca[kf]e/";
manipulations.
$text = "He was eating cake in the cafe.";
if(preg_match($pattern, $text)){
[ <phone>1234</phone>
Step 2: string.xml
<xs:string> data type <?xml version="1.0" encoding="UTF-8"?>
➢ The <xs:string> data type can take <contact
characters, line feeds, carriage returns, xmlns:xs="http://www.w3.org/2001/XMLSchema-
and tab characters. instance” SchemaLocation=”string.xsd”>
➢ The XML processor does not replace Balamurugan
line feeds, carriage returns, and tab </contact>
characters in the content with space Step 3: Validate in Xml validator
and keep them intact. o/p:-
➢ For example, multiple spaces or tabs This XML document is valid
are preserved during display. ii) <xs:date> data type
The <xs:date> data type is used to represent date in
Example:- YYYY-MM-DD format.
Step 1: string.xsd * YYYY − represents year
<?xml version="1.0" encoding="UTF-8"?> * MM − represents month
<xs:schema * DD − represents day
xmlns:xs="http://www.w3.org/2001/XMLS Step 1: date.xsd
chema"> <?xml version="1.0" encoding="UTF-8"?>
<xs:element name=”contact” <xs:schema
type=”xs:string”/> xmlns:xs="http://www.w3.org/2001/XMLSchema">
</xs:schema> <xs:element name=”contact” type=”xs:date”/>
</xs:schema>
Step 2: date.xml
<?xml version="1.0" encoding="UTF-8"?>
<contact
xmlns:xs="http://www.w3.org/2001/XMLSchema-
instance” SchemaLocation=”date.xsd”>
2016-10-17
</contact>
Step 3: Validate in Xml validator
o/p:-
This XML document is valid
iii) <xs:numeric> data type
The <xs:decimal> data type is used to represent
numeric values.
It supports decimal numbers up to 18 digits.
The <xs:integer> data type is used to represent
integer values.
Step 1: numeric.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name=”contact” type=”xs:decimal”/>
a) CSS
b) XSL
➢ It takes XML document, transforms it ➢ Users do not disclose their email address
into another XML document when subscribing to a feed and so are not
increasing their exposure to threats
VELTECH HIGHTECH DR.RANGARAJAN Dr.SAKUNTHALA ENGINEERING COLLEGE Page 86
VELTECH HIGHTECH Dr.RANGARAJAN Dr.SAKUNTHALA ENGINEERING COLLEGE DEPARTMENT
OF COMPUTER SCIENCE AND ENGINEERING
>
</feed>
RSS ATOM
Contains either Contains html, xml,
plain text or dhtml, documents,
escaped sequence audio, video, etc as
as payload payload
Shows timestamp Shows timestamp
of data when feed of data when it was
was last created or last updated
updated
Uses blogger and It has only one
meta weblog standard protocols
protocols
EXAMPLE PROGRAM
<!DOCTYPE html>
<html>
<body>
<div id="demo">
<h1>The XMLHttpRequest Object</h1>
<button type="button"
onclick="loadDoc()">
Change Content
</button>
</div>
<script>
function loadDoc()
5.1.2 STEPS OF PROCESSING IN AJAX {
var xhttp = new XMLHttpRequest();
➢ An event occurs in a web page (the page xhttp.onreadystatechange = function()
is loaded, a button is clicked) {
➢ An XMLHttpRequest object is created by if (this.readyState == 4 && this.status ==
200)
JavaScript
{
➢ The XMLHttpRequest object sends a
request to a web server document.getElementById("demo").innerHTML =
➢ The server processes the request this.responseText;
➢ The server sends a response back to the }
web page };
xhttp.open("GET", "ajax_info.txt", true);
➢ The response is read by JavaScript
xhttp.send();
➢ Proper action (like page update) is
}
performed by JavaScript </script>
</body>
➢
</html>
O/P
SERVER SIDE
State Description
0 The request is not
initialized.
1 The request has
been set up.
2 The request has
been sent.
3 The request is in EXAMPLE PROGRAM
process. <!DOCTYPE html>
4 The request is
completed <html>
<body>
➢ readyState = 0 After you have created the <h2>Using the XMLHttpRequest
XMLHttpRequest object, but before you Object</h2>
have called the open() method <div id="demo">
➢ readyState = 1 After you have called the <button type="button"
open() method, but before you have onclick="loadXMLDoc()">Change Content
called send(). </button>
➢ readyState = 2 After you have called </div>
send(). <script>
➢ readyState = 3 After the browser has function loadXMLDoc()
established a communication with the {
server, but before the server has var xhttp = new XMLHttpRequest();
completed the response. xhttp.onreadystatechange =
➢ readyState = 4 After the request has been function()
completed, and the response data has {
been completely received from the if (this.readyState == 4 &&
server. this.status == 200)
4.7.2FEATURES OF WSDL
Fig. Principle of RPC between a client and
server program ➢ WSDL is an XML-based protocol for
information exchange in decentralized
and distributed environments.
5.6 DESCRIBING A WEB SERVICES ➢ WSDL definitions describe how to
access a web service and what
(WSDL)
operations it will perform.
➢ WSDL is a language for describing
➢ WSDL stands for Web Services how to interface with XML-based
Description Language. services.
➢ It is the standard format for describing ➢ WSDL is an integral part of Universal
a web service. Description, Discovery, and
➢ WSDL was developed jointly by Integration (UDDI), an XML-based
Microsoft and IBM. worldwide business registry.
➢ To exchange information in a ➢ WSDL is the language that UDDI uses.
distributed environment. WSDL is pronounced as 'wiz-dull' and
➢ WSDL is used to describe web spelled out as 'W-S-D-L'.
services
➢ WSDL is written in XML
➢ WSDL is a W3C recommendation
from 26. June 2007
5.7.1 ELEMENTS of WSDL?
Fig. 1
Fig. 3
Step 2: Step 4:
• Right Click on the Databases
• Click on the Ok button .
• Select New Connection as shown
• Now expand the Newly created
below in Fig 2.
database connection.
• It shows the all the tables of the
database test as shown below in
Fig 4.
Fig. 2.
Fig. 4
Step 5:
Fig. 6
• Create a table named login.
• Right Click on the Tables and Step 7:
select Create table
as shown below in Fig 5 • Click on the Ok
• It creates the table login in the
test database.
Step 8:
Fig. 5
Step 6:
Fig. 7
Step 9:
Fig. 9
• Type the project Name as Step 11:
MyAccount
• Click on the next button as shown • It creates a Web Project named
below in Fig 8. MyAccount.
Step 12:
Fig. 8
Step 10:
Fig. 10
Step 13:
Fig. 11
Step 14:
• It creates a WebService
application in design view
• Click on the Add operation as
shown below in Fig 12.
Fig. 13
Step 16:
• It creates a WebService
application
• Click on the source tab as shown
below in the Fig 14.
Fig. 12
Step 15:
Fig. 14
Step 17:
Fig. 15
Step 18:
Step 20:
Fig. 19
Step 22:
@WebService()
public class myaccount {
@Resource(name = "data1")
Step 27:
•
Fig. 21 Check the data in the database table
Step 25: • In the service tab select the mysql
connection
• It runs the deployed webservice in • In its table node right click on the
the firefox browser. table login
• Type the value and click on the • Select the view data as shown
insert button as shown below in below in Fig 24.
Fig 22.
Fig. 24
Fig. 22
Step 27:
Step 26:
Fig. 25
Step 1:
Fig. 26
Fig. 28
Step 2:
Fig. 30
• In the dialog box click on the Step 4:
browse button
as shown below in Fig 29. • Now project is containing the
WSDL file url.
• Click on the Ok button as shown
below in Fig 31.
Fig. 31
Step 5:
Fig. 29
Step 3: • Right Click in the Client.jsp
Fig. 32
Step 5:
Fig. 34
• Select the insert operation as
Step 7:
shown below in Fig .33.
• Deploy the MyAccountClient
• Right Click and select Undeplo and
Deploy as shown below in Fig.35.
Fig. 35 Fig. 37
Step 8: Step 10:
• After deployment run the project. • After this click values get inserted
• Right Click and select the run as in the database table
shown below in Fig 36. • The message comes as record
inserted as shown below in Fig.38
Fig. 38
Step 11:
information soap:encodingStyle="http://www.w3.org/2
003/05/soap-encoding">
➢ A Body element that contains call and
response information <soap:Header> ... </soap:Header>
<soap:Body> ...
➢ A Fault element containing errors and status
information <soap:Fault> ... </soap:Fault>
</soap:Body>
5.10.4 ADVANTAGES OF SOAP
</soap:Envelope>
➢ Simplicity
➢ Portability
SOAP REQUEST
➢ Firewall
POST /Quotation HTTP/1.0
➢ Scalable
Host: www.xyz.org
➢ Flexible
Content-Type: text/xml; charset=utf-8
➢ Interoperability
Content-Length: nnn
5.10.5 RULES
<?xml version="1.0"?>
➢ A SOAP message MUST be encoded using
XML <SOAP-ENV:Envelope xmlns:SOAP-
ENV="http://www.w3.org/2001/12/soap-
➢ A SOAP message MUST use the SOAP
envelope" SOAP-
Envelope namespace
ENV:encodingStyle="http://www.w3.org/20
➢ A SOAP message MUST use the SOAP 01/12/soap-encoding" >
Encoding namespace
<SOAP-ENV:Body
➢ A SOAP message must NOT contain a DTD xmlns:m="http://www.xyz.org/quotations"
reference >
<soap:Envelope </m:GetQuotation>
xmlns:soap="http://www.w3.org/2003/05/s
</SOAP-ENV:Body>
oap-envelope/"
</SOAP-ENV:Envelope>
SOAP RESPONSE
HTTP/1.0 200 OK
Content-Length: nnn
<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-
ENV="http://www.w3.org/2001/12/soap-
envelope" SOAP-
ENV:encodingStyle="http://www.w3.org/20
01/12/soap-encoding" >
<SOAP-ENV:Body
xmlns:m="http://www.xyz.org/quotation" >
<m:GetQuotationResponse>
<m:Quotation>Here is the
quotation</m:Quotation>
</m:GetQuotationResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>