简体   繁体   English

XMLRPC C#客户端到python客户端-方法不存在

[英]XMLRPC c# client to python client - method does not exists

I've searched the web and seen the following question: XML-RPC C# and Python RPC Server 我在网上搜索并看到以下问题: XML-RPC C#和Python RPC Server

I'm trying for a while to do the same, but I fail. 我正在尝试做一阵子,但失败了。 I get the exception "Method "HelloWorld" is not supported..." 我收到异常“不支持方法“ HelloWorld” ...”

[XmlRpcUrl("http://192.168.0.xxx:8000/RPC2")]
public interface HelloWorld : IXmlRpcProxy
{
    [XmlRpcMethod]
    String HelloWorld();
}

private void button1_Click(object sender, EventArgs e)
{
    try
    {
        HelloWorld proxy = CookComputing.XmlRpc.XmlRpcProxyGen.Create<HelloWorld>();
        textBox1.Text = proxy.HelloWorld();
    }
    catch (Exception ex)
    {
        HandleException(ex);
    }
}

And my Python server is: 我的Python服务器是:

class LGERequestHandler(SimpleXMLRPCRequestHandler):
    rpc_paths = ('/RPC2',)

def HelloWorld():
    return "This is server..."

server = SimpleXMLRPCServer(("192.168.0.xxx", 8000),
                        requestHandler=LGERequestHandler)

server.register_introspection_functions()
server.register_function("HelloWorld", HelloWorld)
server.register_instance(self)

# Run the server's main loop
server.serve_forever()

The server is up and running, but I still get an exception. 服务器已启动并正在运行,但是仍然出现异常。

I found the problem: 我发现了问题:

  1. Syntax problem server.register_function("HelloWorld", HelloWorld) should be server.register_function(HelloWorld, "HelloWorld") . 语法问题server.register_function("HelloWorld", HelloWorld)应该是server.register_function(HelloWorld, "HelloWorld")

  2. This change also didn't work, so I changed the function name form helloWorld to hello and it worked(!) 此更改也没有起作用,因此我将函数名称形式从helloWorld更改为hello并成功了(!)

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

相关问题 通过HTTPS实现C#XMLRPC.NET客户端和服务器 - Implementation of C# XMLRPC.NET client and server over HTTPS 适用于.Net和C#扩展的Python-Python中的SignalR客户端(On方法不起作用) - Python for .Net and C# extensions - SignalR client in Python (On method not working) 为什么Redis C#客户端方法.getById()返回null? - Why does Redis C# client method .getById() return null? Mono C#HTTP(XMLRPC.NET)失败:客户端证书或服务器证书问题? - Mono C# HTTPs (XMLRPC.NET) failure : client certificate or server certificate issue? SignalR C#客户端未调用方法 - SignalR C# Client not calling a method 从客户端C#调用WCF方法 - Call WCF method from client c# 使用C#检查客户端计算机的任何驱动器中是否存在目录 - checking if a directory exists in any drive of a client machine using c# C# Google Storage Client - 上传文件 - 如果已经存在则失败 - C# Google Storage Client - Upload file - Fail if already exists C#客户端到客户端消息传递 - C# Client to Client Messaging 将Python SocketServer与C#客户端连接 - Connecting Python SocketServer with C# Client
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM