用C编写XMLRPC并从Python中使用它

2024-04-26 20:54:52 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个C#XML-RPC代码,我想从Python中使用它,是否有能力 实现它?在

这是我的密码 在C中# 1-dll文件

public class Search:MarshalByRefObject
 {
     public string GetAllFiles()
     {
         return ("hhhhhhiiiiiiiiiii");
     }

 }

2-注册方法

^{pr2}$

在python中

 s = ServerProxy('http://localhost:6600')  
  print(s.GetAllFiles())

当我执行它时,我得到以下错误

Traceback (most recent call last):
File "D:\RemotingF\rpc1.py", line 17, in Listen print(s.GetAllFiles()) File "C:\Python27\lib\xmlrpclib.py", line 1224, in call return self._send(self._name, args) File "C:\Python27\lib\xmlrpclib.py", line 1570, in _request verbose=self._verbose File "C:\Python27\lib\xmlrpclib.py", line 1264, in request return self.single_request(host, handler, request_body, verbose) File "C:\Python27\lib\xmlrpclib.py", line 1297, in single_request return self.parse_response(response) File "C:\Python27\lib\xmlrpclib.py", line 1462, in parse_response p.feed(data) File "C:\Python27\lib\xmlrpclib.py", line 557, in feed self._parser.Parse(data, 0) xml.parsers.expat.ExpatError: not well-formed (invalid token): line 1, column 4

有人帮帮我吗 谢谢


Tags: inpyselfverbosereturnresponserequestlib