[AG-DEV] SendEvent of SharedAppClient doesn't work

Eric Liao e.liao at uq.edu.au
Sun Jul 6 21:05:24 CDT 2008


Hi Florian,

When I was developing a SRB browser for AG3 at UQ VisLab I had this
problem when trying to send tree representations of directory structures
through the event channel. I solved it by using 'cPickle' to serialize
the object before sending it, i.e.

<sending end>
share_node_object = cPickle.dumps(share_nodes)
self.sharedAppClient.SendEvent("modifiedData", share_node_object)
self.sharedAppClient.SetData("sharenode", share_node_object)

<receiving end>
node_object = self.sharedAppClient.GetData("sharenode")
self.frame.s_treeData = cPickle.loads(str(node_object))

If you need more implementation details, the program source is hosted at
http://www.vislab.uq.edu.au/research/accessgrid/virtual_fs/index.htm, or
specifically from line 2637 in agSRB.py inside
http://www.vislab.uq.edu.au/research/accessgrid/virtual_fs/packages/win/
agSRB.agpkg3

Good luck!
Eric

-----Original Message-----
From: owner-ag-dev at mcs.anl.gov [mailto:owner-ag-dev at mcs.anl.gov] On
Behalf Of Florian Birnthaler
Sent: 07 July 2008 10:20
To: Chris Willing
Cc: ag-dev at mcs.anl.gov
Subject: RE: [AG-DEV] SendEvent of SharedAppClient doesn't work

Hi Chris,

Thanks for the answer.
So it is currently not possible to send lists or tuples to the event
channel? 
But this must have been possible before, right? Because this is used in
some of the Access Grid tutorials.

For example in the Shared PDF:
self.sharedAppClient.SendEvent("changePage", (self.id, self.pageNr))

I think this was for AG 2.4.
As a workaround I put the tuple together as a string with a
separator-sequence between the different values and send that single
string which will be split again after receiving.
Is there hope that sending tuples or lists will be possible soon again?

Cheers,
Florian


-----Original Message-----
From: Christoph Willing [mailto:c.willing at uq.edu.au]
Sent: Friday, 4 July 2008 6:59 p.m.
To: Florian Birnthaler
Cc: ag-dev at mcs.anl.gov
Subject: Re: [AG-DEV] SendEvent of SharedAppClient doesn't work


On 04/07/2008, at 10:45 AM, Florian Birnthaler wrote:

> Hello,
>
> I have a strange problem with the SendEvent-method of the
> SharedAppClient.
> If I send a string or a number it works without a problem. The
> number/string is perfectly received by the method that I registered as
> the event handler.
> But if I send a tuple or a list I receive a dictionary with the keys
> being some weird strings and their values being the elements of the
> tuple/list.


Florian,


I'm pretty sure that ZSI can only deal with simple types so (for now  
at least) you'll have to break your dictionary (whatever) into simple  
types something like this (from __EnterVenue() in  
AccessGrid.VenueClient.py, which immediately follows a comment about  
this "feature" of zsi):
    self.venueState = VenueState(uniqueId=state.uniqueId,  
name=state.name, description=state.description, uri
=state.uri, connections=state.connections, clients=state.clients,  
data=state.data, eventLocation=evtLocation, tex
tLocation=state.textLocation, dataLocation = state.dataLocation,  
applications=state.applications, services=state.
services)


chris


> Here is an example of some debug messages:
>
> DEBUG: sending SetView event: ('testString1', 'testString2')
> DEBUG: SetView event received: {'Eoa8a390': u'testString1',  
> 'Eoa8a3b8':
> u'testString2'}
>
> I don't chance the events in any way, after I send them. There  
> seems to
> be something wrong with the serialized data that is sent over to the
> event channel. I used the Python debugger to get deeper into the
> SendEvent-call and found out that this SOAP envelope was created:
>
> <SOAP-ENV:Envelope
> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:ZSI="http://www.zolera.com/schemas/ZSI/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><SOAP- 
> ENV:Header><
> /SOAP-ENV:Header><SOAP-ENV:Body><Eo33f9a80
> xmlns:ns1="http://www.accessgrid.org/v3.0"
> xsi:type="ns1:EventDescription"><ns1:channelId
> xsi:type="xsd:string">82664eb22bc448ef7711328383d23793</ 
> ns1:channelId><n
> s1:senderId
> xsi:type="xsd:string">82664eb22bc44a6852b8726be95ce316</ 
> ns1:senderId><ns
> 1:data><Eoaa7f98 xsi:type="xsd:string">testString1</Eoaa7f98><Eoaa7fc0
> xsi:type="xsd:string">testString2</Eoaa7fc0></ns1:data><ns1:eventType
> xsi:type="xsd:string">SetView</ns1:eventType></Eo33f9a80></SOAP- 
> ENV:Body
>> </SOAP-ENV:Envelope>
>
> Here you can already see those strange numbers. But I don't know what
> they mean or how to get rid of them. Because in my event handler  
> method
> T just want to receive the original tuple or list. I searched for a
> solution in the web, but unfortunately I didn't find anything.
> Does someone have an idea how to fix this?
>
> Cheers,
> Florian
>

Christoph Willing                        +617 3365 8350
QCIF Access Grid Manager
University of Queensland







More information about the ag-dev mailing list