1

I've searched the web and seen the following question: XML-RPC C# and 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..."

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

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.

Community
  • 1
  • 1
Guy L
  • 2,824
  • 2
  • 27
  • 37
  • That is not valid python, the dedents dont match the indents. Please edit your answer to reflect the actual code you're having a problem with. (hint: paste the code into the edit box, select the whole block, then click the `{}` button to get the indenting to show up correctly) – SingleNegationElimination Aug 19 '11 at 17:04
  • Looks like the C# client is not considering the method to be "HelloWorld". Maybe if you register it as "HelloWorld.HelloWorld" instead, or something like that. – wberry Aug 19 '11 at 17:34

1 Answers1

1

I found the problem:

  1. Syntax problem server.register_function("HelloWorld", HelloWorld) should be 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(!)

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
Guy L
  • 2,824
  • 2
  • 27
  • 37