Re: [Zope] Asking advice on best way to perform an interaction with an external webservice
Marco Bizzarri wrote at 2008-8-2 10:11 +0200: >I've to implement a SOAP client, and I wonder how to interact with >the external webservice from a transactional point of view: I don't >want to call twice the same service because of ZPublisher redoing >transactions, and this sort of things. For Zope 2.8, the code to interface with the transaction system is in "Shared.DC.ZRDB.TM". Zope's database adapters (e.g. "Products.ZPsycopgDA.db") provides examples for its use. As Andreas told me, there are more modern ways in e.g. Zope 2.11. -- Dieter ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Asking advice on best way to perform an interaction with an external webservice
On Sat, Aug 2, 2008 at 11:36 AM, Andreas Jung <[EMAIL PROTECTED]> wrote: > > > --On 2. August 2008 10:11:10 +0200 Marco Bizzarri <[EMAIL PROTECTED]> > wrote: > >> Dieter, thanks for your answer. >> >> I've to implement a SOAP client, and I wonder how to interact with >> the external webservice from a transactional point of view: I don't >> want to call twice the same service because of ZPublisher redoing >> transactions, and this sort of things. > > The transaction module or the ZODB provides a post-commit hook. > > -aj Thanks Andreas; I assume the post-commit hook is not available in the Zope 2.8 world, am I right? (In the meantime, Marco writes another "+1" to the item on his checklist named "porting to Zope 2.10") -- Marco Bizzarri http://iliveinpisa.blogspot.com/ ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Asking advice on best way to perform an interaction with an external webservice
--On 2. August 2008 10:11:10 +0200 Marco Bizzarri <[EMAIL PROTECTED]> wrote: Dieter, thanks for your answer. I've to implement a SOAP client, and I wonder how to interact with the external webservice from a transactional point of view: I don't want to call twice the same service because of ZPublisher redoing transactions, and this sort of things. The transaction module or the ZODB provides a post-commit hook. -aj pgpk3olimFSJS.pgp Description: PGP signature ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Asking advice on best way to perform an interaction with an external webservice
Dieter, thanks for your answer. I've to implement a SOAP client, and I wonder how to interact with the external webservice from a transactional point of view: I don't want to call twice the same service because of ZPublisher redoing transactions, and this sort of things. Regards Marco On Sat, Aug 2, 2008 at 9:59 AM, Dieter Maurer <[EMAIL PROTECTED]> wrote: > Marco Bizzarri wrote at 2008-8-1 14:57 +0200: >>I need to implement an interaction with an external web service. >> >>The external webservice basically can either provide or accept >>messages from my zope application. The messages are either produced by >>my application (and need to be "sent" to the external application via >>web service) or produced by the external application, and must be >>processed by mine. > > When your application is the client ("sent"), then you > can use any of Python frameworks (e.g. "ZSI", "soaplib") to > interface between Python and the webservice (I fear all these > frameworks by now support only SOAP 1.1, not the current > SOAP 1.2). > > When your application must act as server, you have > several options (all including some webservice framework) > > * set up an additional (non-Zope) server with the support >of the above mentioned frameworks, let it implement >the services. > >If the service needs to access ZODB data, it may >be implemented as a ZEO client (this means, that >you must use ZEO as storage provider for both >your Zope and your service). > > * implement WebService demarshalling/marshalling >in a Zope object. Then, the demarshalling happens >when the Zope object is traversed. Traversal also >changes the response to perform the demarshalling >of the result. > >This requires some fix of "ZPublisher" (as it stupidly >interprets each POST with content-type "text/xml" als >an XML-RPC request. > > * implement an SOAP ZServer > > The first option is probably the easiest. > > We have implemented the second option. The following list > demonstrates the complexity in terms of lines, words and characters: > > newdm: wc *.py >189 6506709 Marshalling.py > 10 20 197 Permissions.py > 27 71 745 ReprRpc.py >110 3933727 Response.py > 47 1281286 RpcType.py >161 6135097 SoapRpc.py >132 5174593 WsdlRpc.py >208 7216645 XmlRpc.py > 19 46 464 __init__.py > 86 3222667 utils.py >9893481 32130 total > > > The third option is probably the most difficult one. > > > > -- > Dieter > -- Marco Bizzarri http://iliveinpisa.blogspot.com/ ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Asking advice on best way to perform an interaction with an external webservice
Marco Bizzarri wrote at 2008-8-1 14:57 +0200: >I need to implement an interaction with an external web service. > >The external webservice basically can either provide or accept >messages from my zope application. The messages are either produced by >my application (and need to be "sent" to the external application via >web service) or produced by the external application, and must be >processed by mine. When your application is the client ("sent"), then you can use any of Python frameworks (e.g. "ZSI", "soaplib") to interface between Python and the webservice (I fear all these frameworks by now support only SOAP 1.1, not the current SOAP 1.2). When your application must act as server, you have several options (all including some webservice framework) * set up an additional (non-Zope) server with the support of the above mentioned frameworks, let it implement the services. If the service needs to access ZODB data, it may be implemented as a ZEO client (this means, that you must use ZEO as storage provider for both your Zope and your service). * implement WebService demarshalling/marshalling in a Zope object. Then, the demarshalling happens when the Zope object is traversed. Traversal also changes the response to perform the demarshalling of the result. This requires some fix of "ZPublisher" (as it stupidly interprets each POST with content-type "text/xml" als an XML-RPC request. * implement an SOAP ZServer The first option is probably the easiest. We have implemented the second option. The following list demonstrates the complexity in terms of lines, words and characters: newdm: wc *.py 189 6506709 Marshalling.py 10 20 197 Permissions.py 27 71 745 ReprRpc.py 110 3933727 Response.py 47 1281286 RpcType.py 161 6135097 SoapRpc.py 132 5174593 WsdlRpc.py 208 7216645 XmlRpc.py 19 46 464 __init__.py 86 3222667 utils.py 9893481 32130 total The third option is probably the most difficult one. -- Dieter ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Asking advice on best way to perform an interaction with an external webservice
Hi all. I need to implement an interaction with an external web service. The external webservice basically can either provide or accept messages from my zope application. The messages are either produced by my application (and need to be "sent" to the external application via web service) or produced by the external application, and must be processed by mine. I'm asking then for best practice for this sort of interaction. Following what I have read in other threads, I would assume that, for example for sending, I should do something like: - create a queue of objects which needs to be sent, in one transaction; - sent the objects which need to be sent, in another transaction; The problem, of course, is to minimize (if not avoid at all) the chance to have a Conflict with a double sending of the message. In some sense, this is very close to sending an email via an smtp server, therefore, I assume I should at the right products to look for inspirations. Thanks you all for your time. Marco -- Marco Bizzarri http://iliveinpisa.blogspot.com/ ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )