【发布时间】:2011-06-20 19:33:35
【问题描述】:
我有一个 C# XML-RPC 代码,我想从 Python 中使用它,是否有能力 实施吗?
这是我的代码 在 C# 中 1- dll文件
public class Search:MarshalByRefObject
{
public string GetAllFiles()
{
return ("hhhhhhiiiiiiiiiii");
}
}
2-注册方法
private void button1_Click(object sender, EventArgs e)
{
ChannelServices.RegisterChannel(new TcpChannel(6600));
RemotingConfiguration.RegisterWellKnownServiceType(
Type.GetType("Search,Search"), "MySearchServer", WellKnownObjectMode.SingleCall);
}
在python中
s = ServerProxy('http://localhost:6600')
print(s.GetAllFiles())
当我执行它时,我得到以下错误
回溯(最近一次通话最后一次):
文件“D:\RemotingF\rpc1.py”,第 17 行, 在听 print(s.GetAllFiles()) 文件“C:\Python27\lib\xmlrpclib.py”,行 1224,在通话中 返回 self._send(self._name, args) 文件 “C:\Python27\lib\xmlrpclib.py”,行 1570,在_请求中 详细=自我。_verbose 文件“C:\Python27\lib\xmlrpclib.py”,行 第1264章 返回 self.single_request(host, handler, request_body, verbose) 文件 “C:\Python27\lib\xmlrpclib.py”,行 第1297章 返回 self.parse_response(response) 文件 “C:\Python27\lib\xmlrpclib.py”,行 第1462章 p.feed(data) 文件“C:\Python27\lib\xmlrpclib.py”,行 557,在饲料中 self._parser.Parse(data, 0) xml.parsers.expat.ExpatError: 不是 格式正确(无效令牌):第 1 行, 第 4 栏
谁能帮帮我 谢谢
【问题讨论】: