XML-RPC - PowerPoint PPT Presentation

About This Presentation
Title:

XML-RPC

Description:

XML_RPC Algorithm – PowerPoint PPT presentation

Number of Views:371
Slides: 22
Provided by: mehrline

less

Transcript and Presenter's Notes

Title: XML-RPC


1
XML-RPC
  • Mohammad Ali Bahrami
  • Meysam Roostaee

2
Client and Server have to understand each other.
  • Wieviel Uhr
  • ist es?

?
Client
Server
3
XML is a common language to transmit data
Encode
Decode
Java C Python etc.
Java C Python etc.
XML
Client
Server
4
What is RPC?
  • RPC means Remote Procedure Call, that means you
    call a procedure (function) on a different
    machine.
  • RPC is a powerful technique for constructing
    distributed, client-server based applications.
  • By using RPC, programmers of distributed
    applications avoid the details of the interface
    with the network.

5
What is XML-RPC?
  • 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.

6
XML-RPC Architecture
HTTP
7
XML-RPC Architecture
  • Client-server architecture
  • Client executes RPCs on the server
  • Server has 3 components
  • The main thread
  • The XML-RPC server (takes place of stubs)
  • One or more RPC handlers
  • Server processes each RPC by calling the
    corresponding RPC handler

8
  • Languages include C/C, Java, Perl, Python,
    Frontier, Lisp, PHP, Microsoft .NET, Rebol, Real
    Basic, Tcl, Delphi, WebObjects and Zope
  • XML-RPC Types
  • integer, boolean, string, double, date
    time, base64 binaries, structs, arrays

9
Executing an XML-RPC
  • 1. Build a list of RPC parameters
  • Analogous to function/method parameters
  • 2. Initialize the RPC
  • Name of the RPC
  • URL (its HTTP) of the XML-RPC server
  • http//addressport/RPC2
  • 3. Execute the RPC
  • 4. Handle errors
  • 5. Interpret return value

10
Creating an XML-RPC Server
  • 1. Define one or more RPC handlers
  • C Subclass xmlrpc_cmethod
  • Java Create a new public class
  • 2. Initialize the librarys server object
  • Provide port number on which to listen
  • 3. Add RPC handlers to the server
  • Library-specific call
  • 4. Start the server
  • Optionally create new thread for server

11
(No Transcript)
12
(No Transcript)
13
XML-RPC
  • Implementation on C

14
Add libraries
  • System.RunTime.Serialization
  • System.RunTime.Serialization.Formatters.Soap

15
Serialize with xml-soap
  • SoapFormatter soap new SoapFormatter()
  • FileStream stnew FileStream ("C\\Test.xml" ,
    FileMode.OpenOrCreate)
  • Person p new Person("Meysam Roostaee",22)Soap.
    Serialize(st, p)
  • st.Close()

16
Deserialize with xml-soap
  • SoapFormatter soap new SoapFormatter
  • FileStream st new FileStream ("C\\Test.xml",Fil
    eMode.Open)
  • Person p soap.Deserialize(st) as Person
  • st.Close()

17
Concept
Client
Client
Response
Request
Request
Request
Client
Client
Client
Server
Response
Response
Response
Request
Client
Client
18
Send request and get result
Send byte variable to server by network
Client
Serialize to xml file
Wait for server
Read xml file in bytes
Object
Calculate and save result in DB and send result
to client
Save data in file with xml extesion
Server
Deserialize xml file
Wait for client
get bytes from network
19
Database
20
Excute Program
  • Server Application
  • Client Application

21
Refrence
  • www.XMLRPC.com
  • Advanced C programming- Raul kimmel
  • XML in C - gholamreza saberi
  • An Introduction to Programming with C Threads
    Andrew D. Birrell
Write a Comment
User Comments (0)
About PowerShow.com