2009-10-17 19 views
5

मेरे सर्वर पर, मैं पाइथन (अतिरिक्त हैलो वर्ल्ड विधि के साथ) के मानक उदाहरण का उपयोग कर रहा हूं और क्लाइंट साइड पर मैं सी # में एक्सएमएल- आरपीसी.NET लाइब्रेरी का उपयोग कर रहा हूं। । लेकिन हर बार जब मैं अपने क्लाइंट को चलाता हूं तो मुझे अपवाद मिलता है कि विधि नहीं मिली है। कोई विचार यह कैसे ठीक करता है।एक्सएमएल-आरपीसी सी # और पायथन आरपीसी सर्वर

धन्यवाद!

पायथन:

from SimpleXMLRPCServer import SimpleXMLRPCServer 
from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler 

# Restrict to a particular path. 
class RequestHandler(SimpleXMLRPCRequestHandler): 
    rpc_paths = ('/RPC2',) 

# Create server 
server = SimpleXMLRPCServer(("", 8000), 
          requestHandler=RequestHandler) 
server.register_introspection_functions() 

# Register pow() function; this will use the value of 
# pow.__name__ as the name, which is just 'pow'. 
server.register_function(pow) 

# Register a function under a different name 
def adder_function(x,y): 
    return x + y 
server.register_function(adder_function, 'add') 

def HelloWorld(): 
     return "Hello Henrik" 

server.register_function(HelloWorld,'HelloWorld') 

# Register an instance; all the methods of the instance are 
# published as XML-RPC methods (in this case, just 'div'). 
class MyFuncs: 
    def div(self, x, y): 
     return x // y 

server.register_instance(MyFuncs()) 

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

सी #

namespace XMLRPC_Test 
{ 
    [XmlRpcUrl("http://188.40.xxx.xxx:8000")] 
    public interface HelloWorld : IXmlRpcProxy 
    { 
     [XmlRpcMethod] 
     String HelloWorld(); 
    } 
    [XmlRpcUrl("http://188.40.xxx.xxx:8000")] 
    public interface add : IXmlRpcProxy 
    { 
     [XmlRpcMethod] 
     int add(int x, int y); 
    } 
    [XmlRpcUrl("http://188.40.xxx.xxx:8000")] 
    public interface listMethods : IXmlRpcProxy 
    { 
     [XmlRpcMethod("system.listMethods")] 
     String listMethods(); 
    } 

    class Program 
    { 
     static void Main(string[] args) 
     { 
      listMethods proxy = XmlRpcProxyGen.Create<listMethods>(); 
      Console.WriteLine(proxy.listMethods()); 
      Console.ReadLine(); 
     } 
    } 
} 
+0

स्टैकट्रैक समेत अपवाद पोस्ट करना संभवतः उपयोगी हो सकता है ... –

उत्तर

5

यह अगर आप इस के लिए घोषणा बदल काम करता है?

[XmlRpcUrl("http://188.40.xxx.xxx:8000/RPC2")] 

Python docs से:

SimpleXMLRPCRequestHandler.rpc_paths

एक विशेषता मान है कि एक टपल XML-RPC अनुरोधों को प्राप्त करने के लिए URL की मान्य पथ भाग लिस्टिंग होना चाहिए। अन्य पथों पर पोस्ट किए गए अनुरोधों के परिणामस्वरूप 404 "ऐसा कोई पृष्ठ नहीं" HTTP त्रुटि होगी। यदि यह ट्यूपल खाली है, तो सभी पथ मान्य मानेंगे। डिफ़ॉल्ट मान है ('/', '/ RPC2')।

+0

शानदार। यह काम करता हैं! –

संबंधित मुद्दे