Re: python client call Java server by xmlrpc
Thanks dieter, The issue is solved. I use SmartSniff to get the xml message send by java client, and python client, find the difference. Define a new class: class MyData(object): def __init__(self,myKey,myValue): self.Key = myKey self.Value = myValue and use this object as parameter, then the server return correct reply. para = MyData(0.5,0.01) server.Fun([para ], [ ] ) From: dieter die...@handshake.de To: python-list@python.org Date: 01/23/2015 03:26 PM Subject: Re: python client call Java server by xmlrpc Sent by: Python-list python-list-bounces+fan.ding1=kodak@python.org fan.di...@kodak.com writes: I have xmlrpc server written in Java, and it has a method like Fun( vector, vector), the vector is array of user-defined object, which is a class extends HashMap. And I call it like: server = xmlrpclib.ServerProxy(http://myserver;) server.Fun( [ {0.5:0.1}], [ ] ) It always fails with error 'No method matching arguments: , [Ljava.lang.Object;, [Ljava.lang.Object; ' Does anyone use this before? It troubles me some days. The standard XML-RPC protocol knows only about a very small set of types. Extensions are required to pass on more type information. The (slightly confusing) error message (you got) indicates that the XML-RPC framework on the server side has not correctly recognized the types of the incoming parameters: it should recognize the [] (as this is a standard type) (and maybe the open [ indicates that it has indeed) but apparently, it got the content elements only as generalized Objects not something specific (extending HashMap). The xmlrpclib in the Python runtime libary does not support extensions to pass on additional type information (as far as I know). This might indicate that you cannot use Python's xmlrpclib out of the box to interact with your Java implemented XML-RPC service. I would approach the problem as follows. Implement a Java based XML-RPC client for your service. Should this fail, then your service implementation has too complex types for XML-RPC (and you must simplify them). Should you succeed, you can use a tcp logger (or maybe debugging tools of the Java libary implementing XML-RPC) to determine the exact messages exchanged between client and server. This way, you can learn how your Java libraries pass on non standard type information. You can then derive a new class from Python's xmlrpclib and implement there this type information passing extension (apparently used by your Java libaries). -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
python client call Java server by xmlrpc
Hi all I have xmlrpc server written in Java, and it has a method like Fun( vector, vector), the vector is array of user-defined object, which is a class extends HashMap. And I call it like: server = xmlrpclib.ServerProxy(http://myserver;) server.Fun( [ {0.5:0.1}], [ ] ) It always fails with error 'No method matching arguments: , [Ljava.lang.Object;, [Ljava.lang.Object; ' Does anyone use this before? It troubles me some days. Thanks a lot. Diana -- https://mail.python.org/mailman/listinfo/python-list
Re: python client call Java server by xmlrpc
fan.di...@kodak.com writes: I have xmlrpc server written in Java, and it has a method like Fun( vector, vector), the vector is array of user-defined object, which is a class extends HashMap. And I call it like: server = xmlrpclib.ServerProxy(http://myserver;) server.Fun( [ {0.5:0.1}], [ ] ) It always fails with error 'No method matching arguments: , [Ljava.lang.Object;, [Ljava.lang.Object; ' Does anyone use this before? It troubles me some days. The standard XML-RPC protocol knows only about a very small set of types. Extensions are required to pass on more type information. The (slightly confusing) error message (you got) indicates that the XML-RPC framework on the server side has not correctly recognized the types of the incoming parameters: it should recognize the [] (as this is a standard type) (and maybe the open [ indicates that it has indeed) but apparently, it got the content elements only as generalized Objects not something specific (extending HashMap). The xmlrpclib in the Python runtime libary does not support extensions to pass on additional type information (as far as I know). This might indicate that you cannot use Python's xmlrpclib out of the box to interact with your Java implemented XML-RPC service. I would approach the problem as follows. Implement a Java based XML-RPC client for your service. Should this fail, then your service implementation has too complex types for XML-RPC (and you must simplify them). Should you succeed, you can use a tcp logger (or maybe debugging tools of the Java libary implementing XML-RPC) to determine the exact messages exchanged between client and server. This way, you can learn how your Java libraries pass on non standard type information. You can then derive a new class from Python's xmlrpclib and implement there this type information passing extension (apparently used by your Java libaries). -- https://mail.python.org/mailman/listinfo/python-list