[Twisted-Python] Twisted & ZSI

Matthew Glubb matt at zgroupplc.com
Tue May 22 09:36:53 EDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi All,

Thanks again Thomas for pointing me in the right direction with  
twisted and ZSI. I apologise if this is getting technically off-topic  
(ie. ZSI) but people seem to get more annoyed about cross posting.  
Berate me about that if it makes you feel better! If you still have  
the patience, I have one major problem that is bugging me:

At the moment, I have the following (test function) working fine  
within twisted and twistd:

def wsa_ProcessAip(self, ps, address, **kw):
     self.request, self.response = CPServiceWSRF.wsa_ProcessAip(self,  
ps, address, **kw)
     self.response._mode = False
     self.response._return = '127.0.0.1'
     return self.request, self.response

*However* I want to return a deferred from this method. I am not sure  
that this is easily possible as ZSI doesn't seem to be recognising a  
return value of either server.NOT_DONE_YET, or a deferred object. It  
is also forcing me to return a tuple containing the ZSI request and  
response objects which is confusing me as I want to return a  
deferred. My ideal would be:

def wsa_ProcessAip(self, ps, address, **kw):
     self.request, self.response = CPServiceWSRF.wsa_ProcessAip(self,  
ps, address, **kw)
     # Don't worry about there being nothing to call back this
     # In my reality it does get called back
     deferred = defer.Deferred()
     deferred.addBoth(self.aipBack)
     return deferred

def aipBack(self, result):
     ip, mode = result
     self.response._mode = mode
     self.response._return = ip
     return self.request, self.response

Is this possible? Scanning the ZSI twisted package, the only mention  
of a deferred object is in the client module. I am also puzzled with  
the 'Delayed Call Sweep' debug line. To me, this indicates some kind  
of deferred.

Thanks a lot for your time :)


Matt


On 21 May 2007, at 17:49, Thomas Jacob wrote:

> ZSI 2.0 has built-in twisted support...
>
> (see --twisted option for wsdl2py/dispatch)
>
> Client side usage:
>
> from MyService_services import *
>
> port = MyServiceLocator().getMyService("http://myhost/MyService")
> port.binding.defer = True
>
> msg = myMethodRequest()
> msg.value =...
> ...
> deferred = port.myMethod(msg)
> deferred.addCallback(....)
>
>
> Server side usage:
>
> Use twisted.web and derive a service class from WSResource:
>
> The following should get you started:
>
> http://proj.badc.rl.ac.uk/ndg/browser/TI12-security/trunk/python/ 
> ndg.security.server/ndg/security/server/SessionMgr/server-config.tac
>
>
> On Mon, 2007-05-21 at 15:43 +0100, Matthew Glubb wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Hi All,
>>
>> Apologies if this has been covered before but there seems to be a
>> dearth of documentation and examples on the net.
>>
>> Does anyone have any tips for integrating ZSI with twisted? I am
>> struggling with the concept of the request / response objects and how
>> they relate to a twisted deferred object. Normally, under twisted, I
>> would return a deferred from the SOAP method call and let the reactor
>> take care of returning the response on callback/errback. How do I do
>> this using ZSI?
>>
>> If anyone has got some *simple* example code, I'd love to see it. I
>> am not particularly concerned with general inter-operability, I am
>> more concerned with getting a particular SOAP client working with my
>> application. SOAPpy doesn't seem to be cutting the mustard, hence the
>> need to try ZSI.
>>
>> Any tips *gratefully* received :)
>>
>> Matt
>>
>>
>> m a t t h e w   g l u b b
>>
>> _____________________________________________________________________ 
>> ___
>> Z Group PLC
>>
>> Tel: +44 (0) 8700 111 173
>> Fax: +44 (0) 8707 051 393
>> Txt: +44 (0) 7800 140 877
>> Web: <http://www.zgroupplc.com/>
>>
>> This  email  and  any  files  transmitted  with it are   
>> confidential and
>> intended solely for the use of the individual or entity to whom  
>> they are
>> addressed.  The opinions  expressed in this mail are those of the  
>> author
>> and do not necessarily  represent the views of the company.  If  
>> you have
>> received this email in error please notify <service at zgroupplc.com>
>>
>>
>>
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.1 (Darwin)
>>
>> iD8DBQFGUbALyI6MkdKPngkRAtB7AJ9uSOBnIDBIxHCAcsw9XGt7TLzWjgCfbnhw
>> QBvvjGEhKT2AtEfhckjliNs=
>> =AnFA
>> -----END PGP SIGNATURE-----
>>
>> _______________________________________________
>> Twisted-Python mailing list
>> Twisted-Python at twistedmatrix.com
>> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python



m a t t h e w   g l u b b

________________________________________________________________________
Z Group PLC

Tel: +44 (0) 8700 111 173
Fax: +44 (0) 8707 051 393
Txt: +44 (0) 7800 140 877
Web: <http://www.zgroupplc.com/>

This  email  and  any  files  transmitted  with it are  confidential and
intended solely for the use of the individual or entity to whom they are
addressed.  The opinions  expressed in this mail are those of the author
and do not necessarily  represent the views of the company.  If you have
received this email in error please notify <service at zgroupplc.com>



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)

iD8DBQFGUvH4yI6MkdKPngkRAgKEAKCSaH+sOfF8M/DyqWCCz7Qy2YtYpQCgoZiH
zn42XMg+wNZvGsssTNr3tfg=
=WHLP
-----END PGP SIGNATURE-----




More information about the Twisted-Python mailing list