我有一個C#XML-RPC代碼,我想從Python中使用它,有沒有一種實現該功能的功能?在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())
當我執行它,我得到以下錯誤
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
誰能幫我 感謝