[Zope] Help: XMLRPC question

Andy McKay andy@agmweb.ca
Tue, 3 Sep 2002 06:59:59 -0700


Whats the error type and value? xmlrpc cannot marshal "None" so if you
return a structure with None in it you get an error, one of these appears in
your traceback.

(Info: (('test1', 'is.lg.ua', '12345678'), {}, None))
--
  Andy McKay
  Agmweb Consulting
  http://www.agmweb.ca


----- Original Message -----
From: "Ruslan Spivak" <alienoid@is.lg.ua>
To: <zope@zope.org>
Sent: Tuesday, September 03, 2002 6:46 AM
Subject: [Zope] Help: XMLRPC question


> Hello zope users,
>
>
> I have comp A Zope and comp B Zope on LAN.
>
> I've wrote python wrappers for vpopmail API (vadduser, vdeluser,
> vpasswd), compiled it into .so module, put it into comp A Zope
> ../zope/lib/python2.1/site-packages and restarted zope.
>
> Here are my external methods on comp A Zope:
>
> import vpopmail # my wrapper module for vpopmail
>
> def vadduser(username, domain, password):
>     return vpopmail.vadduser(username, domain, password, "", 0)
>
> def vdeluser(username, domain):
>     return vpopmail.vdeluser(username, domain)
>
> def vpasswd(username, domain, password):
>     return vpopmail.vpasswd(username, domain, password, 0)
>
> It works OK, each method return 1 if OK and 0 if Error
>
> Problem begins when I begin to call these external methods from comp B
> Zope using XML-RPC.
>
> Comp B Zope external methods
>
> from xmlrpclib import Server
>
> def vadduser(username, domain, password):
>     s = Server(http://server/vpopmail)
>     return s.vadduser(username, domain, password)
>
> .....
>
> So I can get results (0 or 1) from calling ext. methods from comp A
>
> The problem is that it works and sometimes doesn't work.
> Often I get error on comp B Zope:
>
> Traceback (innermost last):
>   File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 150, in
publish_module
>   File /usr/local/zope/lib/python/Products/Localizer/__init__.py, line 65,
in new_publish
>   File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 114, in
publish
>   File /usr/local/zope/lib/python/Zope/__init__.py, line 159, in
zpublisher_exception_hook
>     (Object: vpopmail)
>   File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 98, in
publish
>   File /usr/local/zope/lib/python/ZPublisher/mapply.py, line 88, in mapply
>     (Object: vadduser)
>   File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 39, in
call_object
>     (Object: vadduser)
>   File /usr/local/zope/lib/python/Shared/DC/Scripts/Bindings.py, line 252,
in __call__
>     (Object: vadduser)
>   File /usr/local/zope/lib/python/Shared/DC/Scripts/Bindings.py, line 283,
in _bindAndExec
>     (Object: vadduser)
>   File /usr/local/zope/lib/python/Products/PythonScripts/PythonScript.py,
line 302, in _exec
>     (Object: vadduser)
>     (Info: ({'script': &lt;PythonScript instance at 9988900&gt;,
'context': &lt;Folder instance at 9372fb8&gt;, 'container': &lt;Folder
instance at 9372fb8&gt;, 'traverse_subpath': []}, ('test1', 'is.lg.ua',
'12345678'), {}, None))
>   File Script (Python), line 2, in vadduser
>   File
/usr/local/zope/lib/python/Products/ExternalMethod/ExternalMethod.py, line
198, in __call__
>     (Object: addVpopmailUser)
>     (Info: (('test1', 'is.lg.ua', '12345678'), {}, None))
>   File /usr/local/zope/Extensions/Billing.py, line 72, in addVpopmailUser
>   File /usr/local/zope/lib/python/xmlrpclib.py, line 547, in __call__
>   File /usr/local/zope/lib/python/xmlrpclib.py, line 630, in __request
>   File /usr/local/zope/lib/python/xmlrpclib.py, line 585, in request
>   File /usr/local/zope/lib/python/xmlrpclib.py, line 601, in
parse_response
>   File /usr/local/zope/lib/python/xmlrpclib.py, line 371, in close
> Fault: (see above)
>
>
> N.B. When I change ext. methods on comp A Zope so that they don't
> return anything it work's OK.
> example(on comp A) - old: Doesn't work
>
> def vadduser(username, domain, password):
>     return vpopmail.vadduser(username, domain, password, "", 0)
>
> new: Works
>
> def vadduser(username, domain, password):
>     vpopmail.vadduser(username, domain, password, "", 0)
>
>
> But I need get the result codes.
>
> Please help me with this question, I'm stuck with it.
>
> Best regards,
>  Ruslan                          mailto:alienoid@is.lg.ua
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>