Rmi - RPC
Rmi - RPC
Rmi - RPC
Object Process
Process Process
Host A
remote local C
E
invocation invocation local
invocation remote
invocation F
B local
A
invocation D
Host B
correct lost
Execute request
function
Reply
Request Channel
Execute fails
during
Execute, crash reply
Crash before Reply
reply
Request Client
machine
Execute fails
crash before
Crash before
Reply receiving
execution reply
Applications
MIDDLEWARE
Remote Objects
It's remote procedure calling using HTTP as the transport and XML as
the encoding. XML-RPC is designed to be as simple as possible, while
allowing complex data structures to be transmitted, processed and
returned.
See: http://xmlrpc.scripting.com/spec
XML-RPC and Java: The basic idea
XML
A Java package with A Java package with
specialist methods. specialist methods.
Main program Method: getGreeting()
(Client) (Server)
Client
Different Programming
Languages?
Java
void main () {
cout << getGreeting() << endl;
}
}
C++
Client and Server have to understand each other
Hello, what ?
time is it? Server
Client
Client and Server agree on a common
language.
Client Server
The client encodes the information in the
“common language”, the server decodes the
information.
Decode
Encode
Wieviel Uhr What’s the Quelle heure est-il?
ist es? time?
Client Server
XML-RPC uses XML as a common language to
transmit data
Encode Decode
Java Java
C++ XML C++
Python Python
etc. etc.
Client Server
26
That explains the XML in XML-RPC
but what means RPC?
03/09/2018 06:17:54 29
Languages include:
C/C++, Java, Perl, Python, Frontier, Lisp, PHP,
Microsoft .NET, Rebol, Real Basic, Tcl, Delphi,
WebObjects and Zope
03/09/2018 06:17:54 30
Uses existing protocols (HTTP) and a well
established framework (XML).
03/09/2018 06:17:54 31
The following data structures are supported: integer,
boolean, string, double, date & time, base64 binaries,
structs, arrays.
03/09/2018 06:17:54 32
1. Writing Server and Client
Server
ajshfkdsjhkjsahfkds
hfkhasdfkashfkdjsah
fkshdfkhsafkjshfkds
100
101
kdfjshkdsahfkdashfk
fhakjdhfksjdhfakhsf 011
ajshfkdsjhkjsahfkds
kjsdfkdasjfkdasjksda 011
hfkhasdfkashfkdjsah
jfkdsafhksajhkdjfhk 101
fkshdfkhsafkjshfkds
asjkdsahksdjfksakdj
fhakjdhfksjdhfakhsf 01
sfksakshfdkjfdkdsfh
kjsdfkdasjfkdasjksda
jfkdsafhksajhk
assfksakshfdkjf
Server Server
Example: An XML-RPC client/server
application in Java.
import org.apache.xmlrpc.*;
import java.util.Vector;
Server
ajshfkdsjhkjsahfkds
hfkhasdfkashfkdjsah
fkshdfkhsafkjshfkds
100
101
kdfjshkdsahfkdashfk
fhakjdhfksjdhfakhsf 011
ajshfkdsjhkjsahfkds
kjsdfkdasjfkdasjksda 011
hfkhasdfkashfkdjsah
jfkdsafhksajhkdjfhk 101
fkshdfkhsafkjshfkds
asjkdsahksdjfksakdj
fhakjdhfksjdhfakhsf 01
sfksakshfdkjfdkdsfh
kjsdfkdasjfkdasjksda
jfkdsafhksajhk
assfksakshfdkjf
Server Server
Localhost and remote hosts
• In our example Server and Client are running on the same
Computer. Hence we can use the address
http://localhost/RPC2.
• If you are using the program on two machines that are
connected to the Internet, use the IP address of the Server
machine to make the connection (for instance
http://123.45.67.89/RPC2). You can find the IP address of a
computer with the program ipconfig.
• If the Server machine is registered with a name (as ie.
http://perisic.com ) You can use the name instead of the IP
address (ie. http://perisic.com/RPC2).
• The suffix “/RPC2” is used by some Web Servers to
discriminate between XML-RPC calls and other incoming calls
(for instance requests for HTML pages)
What do we need to tell the client so that it
?
can connect to the Server?
Server
ajshfkdsjhkjsahfkds
hfkhasdfkashfkdjsah
fkshdfkhsafkjshfkds
100
101
kdfjshkdsahfkdashfk
fhakjdhfksjdhfakhsf 011
ajshfkdsjhkjsahfkds
kjsdfkdasjfkdasjksda 011
hfkhasdfkashfkdjsah
jfkdsafhksajhkdjfhk 101
fkshdfkhsafkjshfkds
asjkdsahksdjfksakdj
fhakjdhfksjdhfakhsf 01
sfksakshfdkjfdkdsfh
kjsdfkdasjfkdasjksda
jfkdsafhksajhk
assfksakshfdkjf
Server Server
Client Server