C # XMLRPC client for python client - method does not exist

I searched on the Internet and saw the following question: C # XML-RPC and Python RPC Server

I try to do the same, but I fail. I get an exception "HelloWorld method is not supported ..."

[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:

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 main loop
server.serve_forever()

The server is up and running, but I still get an exception.

+1
source share
1 answer

I found a problem:

  • The syntax task server.register_function("HelloWorld", HelloWorld)should be server.register_function(HelloWorld, "HelloWorld").

  • This change also did not work, so I changed the form of the function name helloWorldto helloand worked (!)

+1
source

Source: https://habr.com/ru/post/1533629/


All Articles