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


Groups > comp.lang.python > #84873

Re: python client call Java server by xmlrpc

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!ecngs!feeder2.ecngs.de!novso.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <fan.ding1@kodak.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'skip:[ 20': 0.04; 'debugging': 0.07; "'no": 0.09; 'extends': 0.09; 'follows.': 0.09; 'indicates': 0.09; 'runtime': 0.09; 'python': 0.11; 'def': 0.12; '"["': 0.16; 'arguments:': 0.16; 'class:': 0.16; 'fail,': 0.16; 'logger': 0.16; 'received:159': 0.16; 'subject:Java': 0.16; 'tcp': 0.16; 'type)': 0.16; 'user-defined': 0.16; 'subject:python': 0.16; '(you': 0.16; 'elements': 0.16; 'extensions': 0.16; 'java,': 0.16; 'implementing': 0.19; 'passing': 0.19; "python's": 0.19; 'written': 0.21; 'error': 0.23; 'recognize': 0.24; 'skip:{ 20': 0.24; 'java': 0.24; 'non': 0.24; 'server.': 0.24; '(or': 0.24; '&gt;': 0.26; 'define': 0.26; 'extension': 0.26; 'recognized': 0.26; 'pass': 0.26; 'skip:_ 20': 0.27; 'header:In-Reply-To:1': 0.27; 'correct': 0.29; 'array': 0.29; 'xml': 0.29; 'matching': 0.30; 'url:mailman': 0.30; 'reply.': 0.31; 'libraries': 0.31; 'types.': 0.31; 'writes:': 0.31; 'anyone': 0.31; 'class': 0.32; 'open': 0.33; 'url:python': 0.33; 'framework': 0.33; 'implemented': 0.33; 'date:': 0.34; 'maybe': 0.34; 'problem': 0.35; 'knows': 0.35; 'something': 0.35; 'but': 0.35; 'there': 0.35; 'interact': 0.36; 'object,': 0.36; 'url:listinfo': 0.36; 'method': 0.36; 'charset:us-ascii': 0.36; 'thanks': 0.36; 'url:org': 0.36; 'should': 0.36; 'too': 0.37; 'email addr:python.org': 0.37; 'implement': 0.38; 'server': 0.38; 'skip:& 10': 0.38; 'skip:[ 10': 0.38; 'to:addr:python-list': 0.38; 'issue': 0.38; 'skip:& 20': 0.39; 'does': 0.39; 'subject:': 0.39; 'to:addr:python.org': 0.39; 'url:mail': 0.40; 'how': 0.40; 'from:no real name:2**0': 0.61; 'new': 0.61; 'information': 0.63; 're:': 0.63; 'more': 0.64; 'by:': 0.65; 'email name:python-list': 0.65; 'side': 0.67; 'between': 0.67; 'determine': 0.67; 'incoming': 0.72; '(apparently': 0.84; 'difference.': 0.84; 'exchanged': 0.84; 'self.value': 0.84; 'before?': 0.93
In-Reply-To <878uguklf3.fsf@handshake.de>
References <OF59D4DFCB.6AA85FAB-ON48257DD5.002C7812-48257DD5.002D68BE@knotes.kodak.com> <878uguklf3.fsf@handshake.de>
X-Disclaimed 15310
To python-list@python.org
MIME-Version 1.0
Subject Re: python client call Java server by xmlrpc
X-KeepSent EA8E5121:C10F5A7F-48257DDD:00327700; type=4; name=$KeepSent
X-Mailer Lotus Notes Release 8.5 SHF183 May 27, 2009
From fan.ding1@kodak.com
Date Fri, 30 Jan 2015 17:15:27 +0800
X-MIMETrack Serialize by Router on KNOTES2/ISBP/EKC(Release 8.5.1FP4 HF14|August 13, 2010) at 01/30/2015 04:15:30 AM, Serialize complete at 01/30/2015 04:15:30 AM
Content-Type multipart/alternative; boundary="=_alternative 0032DAA948257DDD_="
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.18301.1422611335.18130.python-list@python.org> (permalink)
Lines 207
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1422611335 news.xs4all.nl 2888 [2001:888:2000:d::a6]:57262
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:84873

Show key headers only | View raw


[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


Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web