Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #84873 > unrolled thread

Re: python client call Java server by xmlrpc

Started byfan.ding1@kodak.com
First post2015-01-30 17:15 +0800
Last post2015-01-30 17:15 +0800
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: python client call Java server by xmlrpc fan.ding1@kodak.com - 2015-01-30 17:15 +0800

#84873 — Re: python client call Java server by xmlrpc

Fromfan.ding1@kodak.com
Date2015-01-30 17:15 +0800
SubjectRe: python client call Java server by xmlrpc
Message-ID<mailman.18301.1422611335.18130.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw

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 <dieter@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.com@python.org>



fan.ding1@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).

-- 
https://mail.python.org/mailman/listinfo/python-list


[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web