[Zope] POST from Zope to external server and receive RESPONSE

Paul Winkler pw_lists at slinkp.com
Thu Sep 28 09:07:17 EDT 2006


On Thu, Sep 28, 2006 at 10:42:18PM +1000, David at Sidach wrote:
> I've inherited a project that now needs to post an XML
> packet to an ecommerce gateway, ie a user submits, via
> a form, credit card details which are posted to a Zope
> server. The Zope server then builds an XML packet and
> wants to POST to an external server which will send a
> RESPONSE.
> 
> Can I capture that RESPONSE in Zope or must I use external
> methods and something like Python's httplib.
> 
> I've done similar things with curl lib and C++, php curl
> lib and php.
> 
> Any hints folks?

You'll need to use an external method (or write a simple product).
Then you can use httplib or urllib2, or the python wrappers for curl
(I found curl worked in some weird firewall configurations
that httplib didn't).

But you mention XML. If the remote system is XML-RPC, you'll
want to use python's excellent xmlrpclib, which makes
rpc calls look just like local calls:

remote = xmlrpclib.ServerProxy('http://somewhere/something')
result = remote.someMethod('param1', 'param2')

-- 

Paul Winkler
http://www.slinkp.com


More information about the Zope mailing list