1
哈工大计算机学院李全龙Network Application Development Server Software Design 1
Chapter 6: Web and RPC Based
Application Development
Chapter goal:
? WWW and HTTP
? Web Programming
? RPC and Middleware
哈工大计算机学院李全龙Network Application Development Server Software Design 2
WWW and HTTP
哈工大计算机学院李全龙Network Application Development Server Software Design 3
World Wide Web
? Major application used on the
Internet
? Simple interface
? Two concepts
? Point
? Click
哈工大计算机学院李全龙Network Application Development Server Software Design 4
Use of Client-Server Paradigm
? Web server
? Makes set of pages available
? Uses port 80
? Web client
? Called a browser
? Creates TCP connections to server
? Sends requests for items
哈工大计算机学院李全龙Network Application Development Server Software Design 5
Use of Client-Server Paradigm
? Primary protocol used between
browser and server known as
HyperText Transfer Protocol (HPPT)
? HTTP requests sent as text (ASCII)
? GET: request an item from the server
? HEAD: request status information about
an item
? POST: send data to the server
哈工大计算机学院李全龙Network Application Development Server Software Design 6
Use of Client-Server Paradigm
? Response from server begins with ASCII
header
? Status code (200 = handled request)
2
哈工大计算机学院李全龙Network Application Development Server Software Design 7
Web Components
? Browser
? Web server
? Hypermedia links
? Document representation
? Transfer protocol
哈工大计算机学院李全龙Network Application Development Server Software Design 8
Browser
? Application program
? User’s interface to Web
? Becomes Web client to fetch
information from Web server
? Displays information for user
哈工大计算机学院李全龙Network Application Development Server Software Design 9
Inside a Browser
?Main controller
?Receives input from user
?Invokes client and interpreter
?Clients
?One or more built into browser
?Uses network to fetch items
?Interpreter
?One or more built in
?Displays items
哈工大计算机学院李全龙Network Application Development Server Software Design 10
Illustration of a Browser
? Browser contains many components
哈工大计算机学院李全龙Network Application Development Server Software Design 11
Alternative Protocol Example
? File transfer service
? Protocol is FTP
? Example URL
ftp://ftp.cs.purdue.edu/pub/comer/netbook/client.c
? Can be used in anchor tag
哈工大计算机学院李全龙Network Application Development Server Software Design 12
Web Server
? Running program
? Stores set of Web documents
? Responds to request from browser by
sending copy of document
3
哈工大计算机学院李全龙Network Application Development Server Software Design 13
Web Document
? Called a web page
? One web page per file
? Can contain
? Binary image
? Text file
? Text standard
? Readable representation ASCII
? Specifies contents and layout
? Known as Hypertext Markup Language (HTML)
哈工大计算机学院李全龙Network Application Development Server Software Design 14
Hypermedia Concept
? Web document contains mixture of
? Text
? Images
? Selectable pointers to other Web pages
? Known as hypermedia
哈工大计算机学院李全龙Network Application Development Server Software Design 15
Hypermedia Link On
A Web Document
? Associated with object or area on
screen
? Internally like a symbolic link
? Advantage
? Can reference document on another
computer
? Disadvantage
? Can become invalid
哈工大计算机学院李全龙Network Application Development Server Software Design 16
Terminology
? Markup language
? Gives general layout guidelines
? Does not specify exact placement or
format
哈工大计算机学院李全龙Network Application Development Server Software Design 17
Consequence of Using
A Markup Language
Web documents use the HyperText
Markup Language representation.
Instead of specifying a detailed
document format, HTML allows a
document to contain general guidelines
for display, and allows a browser to
choose details. Consequently, two
browsers may display an HTML
document differently.
哈工大计算机学院李全龙Network Application Development Server Software Design 18
HTML Details
? Document is free-format
? Embedded tags give display
guidelines
? Tags often appear in pairs
? Tag format
? Beginning tag: <TAGNAME>
? Ending tag: </TAGNAME>
4
哈工大计算机学院李全龙Network Application Development Server Software Design 19
General Form of HTML
Document
<HTML>
<HEAD>
<TITLE>
text that forms the document title
</TITLE>
</HEAD>
<BODY>
body of the document appears here
</BODY>
</HTML>
哈工大计算机学院李全龙Network Application Development Server Software Design 20
Document Format
<HTML><HEAD><TITLE> text that forms
the document
title</TITLE></HEAD><BODY>body of
the document appears
here</BODY></HTML>
? HTML source is free-form
? Previous example equivalent to this
哈工大计算机学院李全龙Network Application Development Server Software Design 21
Example HTML Tags
?Begin paragraph
<P>
?Line break (force a new line)
<BR>
?Main heading (largest, boldest font)
<H1> … text … </H1>
?Next heading (next largest)
<H2> … text … </H2>
哈工大计算机学院李全龙Network Application Development Server Software Design 22
Example of HTML Line Break
? Input
Hello there.<BR>This is
an example<BR>of HTML.
? Output
Hello there.
This is an example
of HTML.
哈工大计算机学院李全龙Network Application Development Server Software Design 23
Example of HTML Line Break
(continued)
? Input
Hello there.<BR><BR>This
shows<BR>HTML spacing.
? Output
Hello there.
This shows
HTML spacing.
哈工大计算机学院李全龙Network Application Development Server Software Design 24
Example of HTML Headings
? Input
Hello.<BR><H1>This is a
heading</H1><BR>Back to normal.
? Output
Hello.
This is a heading
Back to normal.
5
哈工大计算机学院李全龙Network Application Development Server Software Design 25
Other HTML Features
? Numbered or unnumbered lists
? Images
? Links to other pages
哈工大计算机学院李全龙Network Application Development Server Software Design 26
Images in HTML
? Explicitly denoted as image
? Specified with image tag
? Can specify alignment with text
? Example image tags
<IMG SRC=“file_name”>
<IMG SRC=“file_name” ALIGN=MIDDLE>
哈工大计算机学院李全龙Network Application Development Server Software Design 27
Images in HTML
Here is a picture. <IMG SRC=“file_name”
ALIGN=MIDDLE>
哈工大计算机学院李全龙Network Application Development Server Software Design 28
Links to Other Pages
? Symbolic representation
? Embedded in HTML document
? Browser
? Hides text of link from user
? Associates link with item on page
? Makes item selectable
? Called Uniform Resource Locator
(URL)
哈工大计算机学院李全龙Network Application Development Server Software Design 29
General Form of URL
?Only domain name required
?Defaults
?Protocol is http
?Port is 80
?Path is index.html
protocol :// domain_name : port / item_name
name of access
protocol to use domain name of
server computer
protocol port
number path name
of item
哈工大计算机学院李全龙Network Application Development Server Software Design 30
Link in HTML
? Link specified in <A> tag
? Applies to successive items
? Ends with </A>
? Called anchor
6
哈工大计算机学院李全龙Network Application Development Server Software Design 31
Example of Anchor Tag in HTML
?Input
The text is published by
<A HREF=http://www.prenhall.com>
Prentice Hall, </A> one of the
larger publishers of Computer
Science textbooks.
?Produces
The text is published by Prentice Hall, one of
the larger publishers of Computer Science
textbooks.
哈工大计算机学院李全龙Network Application Development Server Software Design 32
Other Markup Languages
? Extensible Markup Language (XML)
does not specify layout
? Tag names can be created as needed
? Example for a corporate phone book:
哈工大计算机学院李全龙Network Application Development Server Software Design 33
Caching in Browsers
? Cache for recently accessed
? HTML pages
? Images
? Item normally fetched from cache
? User can override
? HTTP can verify timestamp before
fetching new copy
哈工大计算机学院李全龙Network Application Development Server Software Design 34
Types of Web Pages
?Static
?Stored in file
?Unchanging
?Dynamic
?Formed by server
?Created on demand
?Output from a program
?Use Common Gateway Interface (CGI)
technology
哈工大计算机学院李全龙Network Application Development Server Software Design 35
Types of Web Pages (cont)
? Active
? Executed at client
? Consists of a computer program
? Can interact with user
? Use Java technology
哈工大计算机学院李全龙Network Application Development Server Software Design 36
Summary of Web Document Types
Web documents can be grouped into three
categories depending on when the information in
the document changes. The information in a
static document remains unchanged until the
author revises the document. The information
in a dynamic document can change whenever a
server receives a request for the document.
Information displayed by an active document
can change after the document has been loaded
into a browser.
7
哈工大计算机学院李全龙Network Application Development Server Software Design 37
HTTP
? http: Underlying protocol of the
World Wide Web
? transmitting information with
efficiency necessary for hypertext
jumps
? Can transfer plain text, hypertext,
audio, images, and Internet accessible
information
哈工大计算机学院李全龙Network Application Development Server Software Design 38
HTTP Overview
? Transaction oriented client/server
protocol
? Usually between Web browser (client) and
Web server
? Uses TCP connections
? Stateless
? Each transaction treated independently
? Each new TCP connection for each transaction
? Terminate connection when transaction
complete
哈工大计算机学院李全龙Network Application Development Server Software Design 39
Key Terms
? Cache
? Client
? Connection
? Entity
? Gateway
? Message
? Origin server
? Proxy
? Resource
? Server
? Tunnel
? User agent
哈工大计算机学院李全龙Network Application Development Server Software Design 40
Examples of HTTP Operation
哈工大计算机学院李全龙Network Application Development Server Software Design 41
Intermediate HTTP Systems
哈工大计算机学院李全龙Network Application Development Server Software Design 42
Proxy
? A proxy acts on behalf other clients
and presents requests from other
clients to a server
? Two scenarios need use proxy:
? Security intermediary
? Different versions of HTTP
? A proxy is a forwarding agent
8
哈工大计算机学院李全龙Network Application Development Server Software Design 43
Gateway
? A gateway is a server that appears to
the client as if it were an origin
server.
? It acts on behalf of other servers
that may not be able to communicate
directly with a client.
? Two scenarios need use gateway:
? Security intermediary
? Non-HTTP servers
哈工大计算机学院李全龙Network Application Development Server Software Design 44
Tunnel
? Tunnel performs no operation on
HTTP requests and responses.
? A tunnel is simply a relay point
between two TCP connections.
? HTTP messages pass the tunnel
without any changes.
? Use?
哈工大计算机学院李全龙Network Application Development Server Software Design 45
HTTP Messages
? Requests
? Client to server
? Responses
? Server to client
? Request line
? Response line
? General header
? Request header
? Response header
? Entity header
? Entity body
哈工大计算机学院李全龙Network Application Development Server Software Design 46
HTTP Message Structure
哈工大计算机学院李全龙Network Application Development Server Software Design 47
General Header Fields
? Cache control
? Connection
? Date
? Forwarded
? Keep alive
? MIME version
? Pragma
? Upgrade
哈工大计算机学院李全龙Network Application Development Server Software Design 48
Request Methods
? Request-Line = Method <SP> Request_URL <SP> HTTP-Version
<CRLF>
? Methods:
? Options
? Get
? Head
? Post
? Put
? Patch
? Copy
? Move
? Delete
? Link
? Unlink
? Trace
? Wrapped
? Extension-method
9
哈工大计算机学院李全龙Network Application Development Server Software Design 49
Request Header Field
? Accept
? Accept charset
? Accept encoding
? Accept language
? Authorization
? From
? Host
? If modified since
? Proxy authentication
? Range
? Referrer
? Unless
? User agent
哈工大计算机学院李全龙Network Application Development Server Software Design 50
Response Messages
? Status line followed by one or more
general, response and entity headers,
followed by optional entity body
? Status-Line = HTTP-Version <SP>
Status-Code <SP> Reason-Phrase
<CRLF>
哈工大计算机学院李全龙Network Application Development Server Software Design 51
Status Codes
? Informational
? Successful
? Redirection
? Client error
? Server error
哈工大计算机学院李全龙Network Application Development Server Software Design 52
Response Header Fields
? Location
? Proxy authentication
? Public
? Retry after
? Server
? WWW-Authenticate
哈工大计算机学院李全龙Network Application Development Server Software Design 53
Entity Header Fields
? Allow
? Content encoding
? Content language
? Content length
? Content MD5
*
? Content range
*
? Content type
? Content version
? Derived from
? Expires
? Last modified
? Link
? Title
? Transfer encoding
? URL header
? Extension header
哈工大计算机学院李全龙Network Application Development Server Software Design 54
Entity Body
? Arbitrary sequence of octets
? HTTP transfers any type of data including:
? text
? binary data
? audio
? images
? video
? Interpretation of data determined by
header fields
? Content encoding, content type, transfer
encoding
10
哈工大计算机学院李全龙Network Application Development Server Software Design 55
Web Programing
哈工大计算机学院李全龙Network Application Development Server Software Design 56
Client-side programming
? JavaScript
? a scripting language for Web pages, developed by
Netscape in 1995
? uses a C++/Java-like syntax, so familiar to programmers,
but simpler
? good for adding dynamic features to Web page,
controlling forms and GUI
? Java applets
? can define small, special-purpose programs in Java called
applets
? provides full expressive power of Java (but more overhead)
? good for more complex tasks or data heavy tasks, such as
graphics
can download program with Web page, execute on client machine
? simple, generic, but insecure
哈工大计算机学院李全龙Network Application Development Server Software Design 57
Continuously Changing Information
? Needed for
? Animations
? Rapid updates (e.g., stock prices)
? Achieved with two mechanisms
? Server push
? Active document
哈工大计算机学院李全龙Network Application Development Server Software Design 58
Server Push Technology
? Client forms connection
? Server sends updates repeatedly
? Impractical
哈工大计算机学院李全龙Network Application Development Server Software Design 59
Active Document Technology
? Server
? Sends computer program to client
? Client
? Runs program locally
? Program
? Controls display
? Interacts with user
哈工大计算机学院李全龙Network Application Development Server Software Design 60
Active Document Representation
?Desire
?Platform independence
?Efficient execution
?High-speed data transmission
?Late binding
?Consequence
?Compact representation
?Interpretive execution
11
哈工大计算机学院李全龙Network Application Development Server Software Design 61
Active Document Translation
? Compiler produces machine-independent binary
? Browser interprets binary
哈工大计算机学院李全龙Network Application Development Server Software Design 62
Java Technology
?Developed by Sun Microsystems
?Used for
?Conventional applications
?Active documents (applets)
?Includes
?Programming language
?Run-time system
?Class library
哈工大计算机学院李全龙Network Application Development Server Software Design 63
Java Language Characteristics
? High level
? General purpose
? Similar to C++
? Object oriented
? Dynamic
? Strongly typed
? Statically type checked
? Concurrent
哈工大计算机学院李全龙Network Application Development Server Software Design 64
Java Run-Time Environment
Characteristics
? Interpretative execution
? Automatic garbage collection
? Multi-threaded execution
? Internet access
? Graphics support
哈工大计算机学院李全龙Network Application Development Server Software Design 65
Java Library
? Classes for
? Graphics manipulation
? Low-level network I/O
? Interaction with a Web server
? Run-time system access
? File I/O
? Conventional data structures
? Event capture
? Exception handling
哈工大计算机学院李全龙Network Application Development Server Software Design 66
Choice of Graphics Interface
Java includes an extensive graphics toolkit
that consists of run-time support for
graphics as well as interface software. The
toolkit allows a programmer to choose a
high-level interface, in which the toolkit
handles details, or a low-level interface, in
which the applet handles details.
12
哈工大计算机学院李全龙Network Application Development Server Software Design 67
Example Java Applet
? Window with two items
? Text area
? Button
? Change text when button clicked
哈工大计算机学院李全龙Network Application Development Server Software Design 68
Illustration of Applet Display
? Initial
?After user clicks button
哈工大计算机学院李全龙Network Application Development Server Software Design 69
Example Applet Code
哈工大计算机学院李全龙Network Application Development Server Software Design 70
Applet Invocation
?Available in HTML
?Uses applet tag
?Specifies
?Codebase (machine and path)
?Code (specific class to run)
?Example
<applet
codebase=“www.nonexist.com/pth”
code=“bbb.class”>
哈工大计算机学院李全龙Network Application Development Server Software Design 71
Java Functionality
?HTML interface
?Controls display
?Interacts with user
?HTTP interface
?Accesses remote Web documents
?Invokes other applets
?Exceptions
?Indicate unanticipated circumstances
?Can be caught and handled
哈工大计算机学院李全龙Network Application Development Server Software Design 72
Example Applet Code
13
哈工大计算机学院李全龙Network Application Development Server Software Design 73
Example Applet Code (continued)
哈工大计算机学院李全龙Network Application Development Server Software Design 74
Illustration of Applet Display
哈工大计算机学院李全龙Network Application Development Server Software Design 75
JavaScript Technology
? Alternative to Java technology
? Provides scripting language
? Browser reads and interprets script
in source form
? JavaScript can be integrated with
HTML
哈工大计算机学院李全龙Network Application Development Server Software Design 76
JavaScript Example
哈工大计算机学院李全龙Network Application Development Server Software Design 77
JavaScript Example
哈工大计算机学院李全龙Network Application Development Server Software Design 78
Server-side programming
? CGI programming
? programs can be written to conform to the Common
Gateway Interface
? when a Web page submits, data from the page is sent as
input to the CGI program
? CGI program executes on server, sends its results back
to browser as a Web page
? good if computation is large/complex or requires access
to private data
? Active Server Pages, Java Servlets, PHP, Server Side
Includes
? vendor-specific alternatives to CGI
? provide many of the same capabilities but using HTML-like
tags
can store and execute program on Web server, link from Web page
? more complex, requires server privileges, but secure
14
哈工大计算机学院李全龙Network Application Development Server Software Design 79
CGI Technology
?URL specifies
?Location of Web server
?CGI program on that server
?Arguments to program
?Web server
?Uses TCP for communication
?Accepts HTTP request from client
?Runs specified CGI program
?Returns output to client
哈工大计算机学院李全龙Network Application Development Server Software Design 80
CGI Technology (cont)
? CGI program
? Performs arbitrary computation
? Often written in a scripting language
? Produces output file when run
? Starts output with header
哈工大计算机学院李全龙Network Application Development Server Software Design 81
Header in CGI Output
? Stops at first blank line
? Identifies
? Encoding used
? Type of document
? Format
keyword: information
哈工大计算机学院李全龙Network Application Development Server Software Design 82
CGI Header Examples
? HTML document header
Content Type: text/html
? Text document header
Content Type: text/plain
? Redirection header
Location: /over_here/item4
哈工大计算机学院李全龙Network Application Development Server Software Design 83
Example CGI Script
? Generates document
? Document contains three lines of text
? Header
? Blank line
? Document creation date
哈工大计算机学院李全龙Network Application Development Server Software Design 84
Parameters
? CGI programs can be parameterized
? URL can contain arguments that are
passed to CGI program
? Question mark separates CGI path
from arguments
? Server places information following
question mark in environment variable
QUERY_STRING
15
哈工大计算机学院李全龙Network Application Development Server Software Design 85
Example Environment Variables
哈工大计算机学院李全龙Network Application Development Server Software Design 86
Encoding Information in a URL
? Information that program stores
between invocations: state information
? Information passed to browser in
form of cookie
? Cookie consists of name/value pair
? Long term (persistent) or short term
(session)
哈工大计算机学院李全龙Network Application Development Server Software Design 87
Long-Term State Information
? Program lifetime
? CGI program invoked by server
? Program exits after generating output
? To maintain persistent data
? Write to file on disk
? Read from file on disk
哈工大计算机学院李全龙Network Application Development Server Software Design 88
Long-Term State Information
? Client’s IP address in environment variable
? Check if address in file
? Respond to client
哈工大计算机学院李全龙Network Application Development Server Software Design 89
Short-Term State Information
? Each invocation of a dynamic document
program can produce a document
containing a new set of URLs
? Use new arguments in new URLs
哈工大计算机学院李全龙Network Application Development Server Software Design 90
Short-Term State Information
? Argument encodes number of times executed
16
哈工大计算机学院李全龙Network Application Development Server Software Design 91
Example of Script Execution
?Initial document
Content-type: text/html
<HTML>
This is the initial page.<BR><BR>
<A HREF=“http://www.nonexist.com/cgi/ex4?1”>
Click here to refresh the page.</A> </HTML>
?Resulting display
This is the initial page.
Click here to refresh the page.
哈工大计算机学院李全龙Network Application Development Server Software Design 92
Example of Script Execution
?Generated output
Content-type: text/html
<HTML>
You have displayed this page 2 times.<BR><BR>
<A HREF=“http://www.nonexist.com/cgi/ex4?2”>
Click here to refresh the page.</A> </HTML>
?Resulting display
You have displayed this page 2 times.
Click here to refresh the page.
哈工大计算机学院李全龙Network Application Development Server Software Design 93
Generated URL Values
When it generates a document, a dynamic
document program can embed state
information as arguments in URLs. The
argument string is passed to the program
for the URL, enabling a program to pass
state information from one invocation to
the next.
哈工大计算机学院李全龙Network Application Development Server Software Design 94
Server-Side Scripting
? ASP (Active Server Pages)
? JSP (Java Server Pages)
? PHP (Perl Helper Pages)
? ColdFusion
哈工大计算机学院李全龙Network Application Development Server Software Design 95
Server-Side Scripting
Server-side scripting technologies allow
a dynamic page to be created from a
template or skeleton that contains
embedded commands or program
scripts. Instead of using a computer
program to generate an entire page, an
interpreter copies the page and
replaces only the scripting commands.
哈工大计算机学院李全龙Network Application Development Server Software Design 96
RPC and Middleware
17
哈工大计算机学院李全龙Network Application Development Server Software Design 97
What is RPC?
? Local Procedure Calls
? Transfer of control as well as data
between procedure calls does not cross
process boundary.
? RPC = Remote Procedure Calls
? Method invocation to transfer control as
well as data between multiple processes.
? Processes may run on same or different
machines.
哈工大计算机学院李全龙Network Application Development Server Software Design 98
Remote Procedure Call
? Uses standard procedure call
paradigm
? Divides program along procedure call
boundaries
? Main program and procedures for user
interaction in client side
? Other procedures in server side
哈工大计算机学院李全龙Network Application Development Server Software Design 99
Illustration of Conventional
Procedure Call Graph
? Arrow denotes procedure call
哈工大计算机学院李全龙Network Application Development Server Software Design 100
Procedure Call Graph Divided
Into Client and Server
? Division occurs on call boundary
? Main program in client piece
哈工大计算机学院李全龙Network Application Development Server Software Design 101
RPC Programming Model
1. Create an interface
? Type of interface = Name of interface
? Signatures of all procedures with procedure
names, arguments and return type
2. Provide the interface to interface module,
which generates user stub and server
stub
3. Implement procedures in the interface
using the server stub
4. Export the interface to a broker or a
repository, known as Binding an interface
5. Implement the client application using the
user stub and invoke remote procedure
哈工大计算机学院李全龙Network Application Development Server Software Design 102
RPC – How does it work?
18
哈工大计算机学院李全龙Network Application Development Server Software Design 103
RPC – How does it work?
Caller Machine
1. A user process on caller invokes a remote
method, which invokes the user stub.
2. User stub serializes arguments of method and
invokes RPC Runtime.
3. RPC Runtime imports the interface from the
broker, which implements the desired procedure.
In this way, it obtains the server network
address for invoking remote procedure.
4. RPC Runtime transmits call packets to callee
machine and waits for response.
哈工大计算机学院李全龙Network Application Development Server Software Design 104
RPC – How does it work?...
Callee Machine
5. RPC Runtime receives request, instantiates
the stub and forwards request to it.
6. Server stub de-serializes arguments and
invokes the remote method on server. The
remote method returns on and invokes server
stub with return value.
7. Server stub serializes return value and
invokes RPC Runtime to respond with result
packet.
8. RPC Runtime returns the result packets to
RPC runtime running on callee machine.
哈工大计算机学院李全龙Network Application Development Server Software Design 105
RPC – How does it work?...
Caller Machine
9. RPC runtime relays received result
packets to user stub for the invoked
RPC method.
10. User stub de-serializes the result
value and returns it to the caller
process.
哈工大计算机学院李全龙Network Application Development Server Software Design 106
Components of RPC System
? Interface Module a.k.a IDL Compiler
? Generates server stub and user stub for
a user specified interface
? An interface declares:
? Type of interface
? Signatures of remote procedures
? Optionally, an implementer of required
interface
哈工大计算机学院李全龙Network Application Development Server Software Design 107
Components of RPC System…
? User Stub a.k.a Stub
? Serialize arguments
? Placing specification of target procedure
and serialized arguments into one or
more packets.
? Request RPC Runtime on caller machine
to reliably transmit it to callee machine.
哈工大计算机学院李全龙Network Application Development Server Software Design 108
Components of RPC System…
? Server Stub a.k.a. Skeleton
? Accepts data packets from RPC Runtime
on callee machine
? De-serializing data packets and
reconstruct arguments
? Invoke remote procedure call
? Serialize return value into data packet
? Request RPC Runtime to deliver return
packets to caller machine
19
哈工大计算机学院李全龙Network Application Development Server Software Design 109
Components of RPC System…
? RPC Runtime
? Accepting and delivering data packets from
user stub and server stub
? When a remote procedure call is invoked, it
inquires the implementer of interface from
broker if the implementer is not known
? Establishes reliable and secure communication
between caller and callee
? The communication between caller and callee
may be encrypted to enforce network level
security
哈工大计算机学院李全龙Network Application Development Server Software Design 110
Components of RPC System…
? Distributed Database
? Broker between caller and callee.
? Holds a map/dictionary of
[ Type of interfaces, List of its implementer ]
? Server RPC Runtime exports interface it
implements to distributed database
? Client RPC Runtime inquires implementer of
interface from distributed database, before
invoking a RPC for the first time.
? ACL restricts entities that can export
interface to it.
? Needs to have high availability.
哈工大计算机学院李全龙Network Application Development Server Software Design 111
RPC Incarnations
? Functional Programming
? Sun RPC
? OSF DCE
? Object Oriented Programming
? CORBA
? Java Remote Method Invocation (RMI)
? Microsoft DCOM
? .NET Remoting
哈工大计算机学院李全龙Network Application Development Server Software Design 112
RPC Deployment Issues
? RPC server machine listens for a
request on a specific port. Need to
punch a hole in firewall to allow RPC
server request. It leads to security
concerns.
? Procedure semantics and protocols
for RPC implementation use
proprietary protocols. It lead to
interoperability problem.
哈工大计算机学院李全龙Network Application Development Server Software Design 113
Recent Developments
? Industry-wide support for using Web
Services for distributed computing
? RPC over HTTP
? Circumvents firewall issue
? Use of SOAP (XML) to exchange information
about procedure and its arguments
? Circumvents interoperability issue – Java Client
can communicate with server written in .NET
and vice versa
? Using UDDI for discovering services
哈工大计算机学院李全龙Network Application Development Server Software Design 114
Middleware
? Tools to help programmers
? Makes client-server programming
? Easier
? Faster
? Makes resulting software
? Less error-prone
? More reliable
20
哈工大计算机学院李全龙Network Application Development Server Software Design 115
Middleware Approach
?Allow programmer to work with
familiar language constructs
?Provide tools to help programmer
?Special translators
?Libraries
?Automatically generate code for
?Network communication
?Connection management
哈工大计算机学院李全龙Network Application Development Server Software Design 116
Middleware Technologies That
Use Remote Procedure Call
? ONC RPC
? Open Network Computing
? IETF standard
? Popular in Unix world
? DCE RPC
? Distributed Computing Environment
? Open Group Standard
哈工大计算机学院李全龙Network Application Development Server Software Design 117
Middleware Technologies That Use
Remote Procedure Call (continued)
? MSRPC
? Microsoft
? Variant of DCE RPC
哈工大计算机学院李全龙Network Application Development Server Software Design 118
Object-Oriented Middleware
?Designed for use with object-oriented
programming languages
?Same general scheme as RPC
?Interface Definition Language
?Tool to build stubs
?Libraries to handle network
communication
?Uses method invocation instead of
procedure call
哈工大计算机学院李全龙Network Application Development Server Software Design 119
Middleware Technologies That
Use Remote Object Invocation
? CORBA
? Common Object Request Broker
Architecture
? Well known object-oriented middleware
? MSRPC2
? Microsoft
? Also called Object RPC (ORPC)
哈工大计算机学院李全龙Network Application Development Server Software Design 120
Middleware Technologies That
Use Remote Object Invocation
? COM / DCOM
? Also from Microsoft
? Component Object Model (COM)
? Used on single computer
? Provides mechanism for inter-object
references
? Distributed Component Object Model
? Used across multiple computers
? Includes communication stubs
21
哈工大计算机学院李全龙Network Application Development Server Software Design 121
Middleware Technologies That
Use Remote Object Invocation
? RMI
? From Sun Microsystems
? Methods of remote Java objects can be invoked
from other Java virtual machines on different
hosts
? Jini
? Also from Sun; based on Java
? Provides an environment for creating dynamically
networked components, applications, and services
that scale
哈工大计算机学院李全龙Network Application Development Server Software Design 122
Summary
? Web is major application in Internet
? Client
? Called browser
? Fetches and displays document
? Web documents
? Stored on servers
? Standard representation is HTML
哈工大计算机学院李全龙Network Application Development Server Software Design 123
Summary (continued)
?HTML
?Markup language
?Uses tags embedded in text
?URL components
?Protocol
?Domain name of server
?Protocol port number
?Path of item
?Only domain is required
哈工大计算机学院李全龙Network Application Development Server Software Design 124
Summary (continued)
? Static web page
? Unchanging
? Dynamic web page
? Output from a program on the server
? Active web page
? Runs in browser
? Consists of a computer program
哈工大计算机学院李全龙Network Application Development Server Software Design 125
Summary (continued)
? Dynamic web page technology
? Known as CGI
? CGI program usually a script
? Document begins with header line
? URL can contain arguments
哈工大计算机学院李全龙Network Application Development Server Software Design 126
Summary (continued)
? Active web page technology
? Known as Java
? Programming language plus runtime
support
? Document called applet
22
哈工大计算机学院李全龙Network Application Development Server Software Design 127
Summary (continued)
? RPC
? Middleware
? Tools to help build client and server
? Automates routine tasks
? Two popular paradigms
? Remote procedure call
? Object invocation
? Generates communication stubs