What is XML-RPC?
XML-RPC is the nasal ancestors of XML Web services. It is a simple specification for remote procedure call, RPC. This call uses HTTP as a transport protocol and uses XML vocabulary as a message payload. Since the XML-RPC is very simple (the entire specification is printed, it is still not ten sheets), it has become very popular, and now most languages have standard or available XML-RPC implementations. These languages include Python, which starts bundled XMLRPClib (XML-RPC implementation developed by Fredrik Lundh) in version 2.2. First, we intend to transform the CMS (Context Manager System) system, the first thing, the first thing to open outward, available for remote calls.
import SimpleXMLRPCServer # define their own CMS class class MyCMS: def getVersion (self): # version of the method disclosed in the outward return "Powerd By Python 0.1a" cms = MyCMS () server = SimpleXMLRPCServer.SimpleXMLRPCServer (( "localhost", 8888) Server.register_instance (cms) Print "Listening On Port 8888" Server.serve_Forever () # server execution, and listen to the 8888 port execution screenshot: This topic related image client calls code, get the latest version information
Import XmlrpClibServer = XmlrpClib.serverProxy ("http: // localhost: 8888";) Version = Server.getVersion () Print "Version:" Version execution screenshot: This topic related picture summary: The same Java is clearly code quantity Reduce, make more energy to concentrate on the system itself to Java's XMLRPC implementation: http: //ws.apache.org/xmlrpc/java call code as follows: