python client call Java server by xmlrpc

dieter dieter at handshake.de
Fri Jan 23 02:26:08 EST 2015


fan.ding1 at 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 "Object"s 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).




More information about the Python-list mailing list