Download presentation
Presentation is loading. Please wait.
1
XML-RPC
2
General Procedure Call
Procedures or functions normally exist within the same machine / same memory space as the main function Memory space Main function Sub-function 1 Sun-function 2 Sub-function 3
3
Remote Procedure Call (RPC)
Procedures are not reside in the same memory space or same machine as the main function Computer 1 Computer 2 Network Remote procedure Main function
4
Remote Procedure Call (RPC)
Characteristics It is a protocol the enable a program to request a service which is located in another computer (make a remote function call) in the network the same way as calling local functions Synchronous operation Resource sharing is the main goal Utilize client/server model No compatibility between RPC from different language
5
XML-RPC Use XML to format request message (function call) and response message (return value) Break the language boundary Utilize HTTP Founded ~1998
6
XML-RPC Technical XML-RPC Data model XML-RPC Request structure
XML-RPC Response structure
7
XML-RPC Data Model 6 basic types
int or i4 : 32-bit integer double : 64-bit floating point boolean : 1 (true) or 0 (false) string datetime.iso8601 : YYYYMMDDTHH:MM:SS base64 : base64 encoding Basic types are always enclosed in <value>
8
Basic Type examples <value><int>100</int></value> <value><double>3.14</double></value> <value><boolean>1</boolean></value> <value><string>an example</string></value> <value><datetime.iso8601> T09:00:00 </datetime.iso8601></value>
9
XML-RPC Data Model 2 complex types Arrays Structs
Array can contain mixtures of different types Structs
10
Complex type example <value> <array> <data> <value><int>10</int><value> <value><int>20</int><value> </data> </array> </value>
11
Complex type example <value> <array> <data> <value><int>10</int><value> <value><string>abcd</string><value> </data> </array> </value>
12
Complex type example <value> <array> <data> <value><int>10</int><value> <value><int>20</int><value> </data> </array> </value> <value><int>30</int><value> <value><int>40</int><value>
13
Complex type example <value> <struct> <member> <name>firstname</name> <value><string>John</string></value> </member> <name>lastname</name> <value><string>Doe</string></value> </struct> </value>
14
XML-RPC Request Structure
<?xml version=“1.0” ?> <methodCall> <methodName>…………..</methodName> <params> <param> <value>……</value> </param> …. </params> </methodCall> Use HTTP POST method
15
XML-RPC Response Structure
<?xml version=“1.0” ?> <methodResponse> <params> <param> <value>……</value> </param> </params> </methodResponse> Only one <param> is allowed If it is a void function -> modify it to return value for example return 1 if successfully execute Return value is required
16
XML-RPC Response Structure
<?xml version=“1.0” ?> <methodResponse> <fault> <value>……</value> </fault> </methodResponse>
17
XML-RPC Example - Function
18
XML-RPC Example - Server
19
XML-RPC Example - Client
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.