Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: Users

Asking advice on best way to perform an interaction with an external webservice

 

 

Zope users RSS feed   Index | Next | Previous | View Threaded


marco.bizzarri at gmail

Aug 1, 2008, 5:57 AM

Post #1 of 6 (802 views)
Permalink
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[at]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 )


dieter at handshake

Aug 2, 2008, 12:59 AM

Post #2 of 6 (764 views)
Permalink
Re: Asking advice on best way to perform an interaction with an external webservice [In reply to]

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 650 6709 Marshalling.py
10 20 197 Permissions.py
27 71 745 ReprRpc.py
110 393 3727 Response.py
47 128 1286 RpcType.py
161 613 5097 SoapRpc.py
132 517 4593 WsdlRpc.py
208 721 6645 XmlRpc.py
19 46 464 __init__.py
86 322 2667 utils.py
989 3481 32130 total


The third option is probably the most difficult one.



--
Dieter
_______________________________________________
Zope maillist - Zope[at]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 )


marco.bizzarri at gmail

Aug 2, 2008, 1:11 AM

Post #3 of 6 (755 views)
Permalink
Re: Asking advice on best way to perform an interaction with an external webservice [In reply to]

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 <dieter[at]handshake.de> 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 650 6709 Marshalling.py
> 10 20 197 Permissions.py
> 27 71 745 ReprRpc.py
> 110 393 3727 Response.py
> 47 128 1286 RpcType.py
> 161 613 5097 SoapRpc.py
> 132 517 4593 WsdlRpc.py
> 208 721 6645 XmlRpc.py
> 19 46 464 __init__.py
> 86 322 2667 utils.py
> 989 3481 32130 total
>
>
> The third option is probably the most difficult one.
>
>
>
> --
> Dieter
>



--
Marco Bizzarri
http://iliveinpisa.blogspot.com/
_______________________________________________
Zope maillist - Zope[at]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 )


lists at zopyx

Aug 2, 2008, 2:36 AM

Post #4 of 6 (763 views)
Permalink
Re: Asking advice on best way to perform an interaction with an external webservice [In reply to]

--On 2. August 2008 10:11:10 +0200 Marco Bizzarri
<marco.bizzarri[at]gmail.com> 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


marco.bizzarri at gmail

Aug 3, 2008, 12:45 AM

Post #5 of 6 (748 views)
Permalink
Re: Asking advice on best way to perform an interaction with an external webservice [In reply to]

On Sat, Aug 2, 2008 at 11:36 AM, Andreas Jung <lists[at]zopyx.com> wrote:
>
>
> --On 2. August 2008 10:11:10 +0200 Marco Bizzarri <marco.bizzarri[at]gmail.com>
> 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[at]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 )


dieter at handshake

Aug 10, 2008, 12:17 AM

Post #6 of 6 (656 views)
Permalink
Re: Asking advice on best way to perform an interaction with an external webservice [In reply to]

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[at]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 users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.