简体   繁体   English

XMLRPC Python服务器

[英]XMLRPC Python server

I'm working on a project that has a XML-RPC PHP client connecting to a python server. 我正在一个具有XML-RPC PHP客户端连接到python服务器的项目。 I got the PHP client to work but don't know how the python server takes input parameters. 我让PHP客户端正常工作,但不知道python服务器如何接受输入参数。 From the PHP client we send a message with a string and two integer and want the python server to use those values to perform calculations. 从PHP客户端,我们发送带有字符串和两个整数的消息,并希望python服务器使用这些值执行计算。

How does XML-RPC servers in python take in values sent from the client? python中的XML-RPC服务器如何接收客户端发送的值?

Thanks! 谢谢!

You can check xmlrpclib for python implementation of this standard. 您可以检查xmlrpclib以了解此标准的python实现。

Here a server side example from there: 这里是服务器端的示例:

from SimpleXMLRPCServer import SimpleXMLRPCServer

def is_even(n):
    return n%2 == 0

server = SimpleXMLRPCServer(("localhost", 8000))
print "Listening on port 8000..."
server.register_function(is_even, "is_even")
server.serve_forever()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM