I. Introduction
In order to provide RPC services on port 80 of the system without affecting the web services being executed, people have come up with a way to transmit RPC packets over HTTP. For an HTTP protocol that is used to transmit text, the most convenient way to transmit RPC packets on it is to encode RPC packets into text formats, such as XML files.
XML-RPC (http://www.xml-rpc.com) is an RPC protocol specified by userland. It encodes RPC Information packets into XML and then transmits packets through HTTP;
Simple understanding:
Data is defined as XML for remote transmission over HTTP.
Ii. Benefits
1. Transmit complex data.
2. PassProgramLanguage encapsulation to call remote objects.
Iii. XMLRPC application in Python
Server:
Import Simplexmlrpcserver
class myobject:
def sayhello (Self):
return " Hello xmlprc "
OBJ=Myobject ()
Server=Simplexmlrpcserver. simplexmlrpcserver (("Localhost",80))
Server. register_instance (OBJ)
Print "Listening on port 80"
Server. serve_forever ()
Client:
Import xmlrpclib
server = xmlrpclib. serverproxy ( " HTTP: // localhost: 80 " )
words = server. sayhello ()
Print " result: " + words