[flexcoders] Re: Flex, SOAP and Process Flow

2010-01-20 Thread trefalgar
--- In flexcoders@yahoogroups.com, Amy amyblankens...@... wrote:
 Honestly, I'm not sure how it is that you don't see any difference between 
 what I my example shows and what you're doing.  My fault/result method 
 signatures are completely different--they have a different number of 
 arguments and expect different data types.  These are the kind of details you 
 need to train yourself to pick up on, or you're going to continue to find the 
 documentation unhelpful.

*chuckle* Arguments are easily detected, as are the differences - it simply 
wont work if you're sending too many or too few arguments to a new function 
call (custom or stock). But in the case of your fault/result method, it's a 
simple thing to work around. The way the other responder works, at least in the 
documentation and code examples I've seen, it's pretty clear how to get the 
result/fault and the AsyncToken. 

But in the end, that's not the issue ... if the responder never seems to be 
called, everything else is moot :\ This is why I'm wondering if you can't wrap 
AsyncToken calls around AsyncToken calls - if the SDK just gets confused or 
ignores nesting like that.

Either way, closure appears to be working for me right now, which is the 
important part.

Tref



RE: [SPAM] [flexcoders] Re: Flex, SOAP and Process Flow

2010-01-20 Thread Tracy Spratt
One simple way to do this is to use the result and fault handlers in the
service, put an identifying key in the asyncToken on send, extract that key
in the result, and use it in a switch to determine processing.

 

Tracy Spratt,

Lariat Services, development services available

  _  

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of trefalgar
Sent: Tuesday, January 19, 2010 2:03 PM
To: flexcoders@yahoogroups.com
Subject: [SPAM] [flexcoders] Re: Flex, SOAP and Process Flow

 

  

--- In flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com,
trefalgar trefal...@... wrote:

 --- In flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com,
Amy amyblankenship@ wrote:
  I always use mx.rpc.Responder instead of AsyncResponder (is that a
custom class?). There's a working example of using AsyncToken with AMFPHP
here http://flexdiary.
http://flexdiary.blogspot.com/2009/01/lazy-loading-tree-example-file-posted
.html blogspot.com/2009/01/lazy-loading-tree-example-file-posted.html .
Maybe that will help you see something the docs aren't showing you.
 
 var token:AsyncToken =
myService.disableStatistics(user,pass,email,tArray);
 token.info = email;
 token.addResponder(new AsyncResponder(myResults,myFaults,token));

I forgot this little bit - using Responder over AsyncResponder. As far as I
can tell, it's not a custom class as it's included by default in the SDK. 

As far as usage, if I use Responder over AsyncResponder, I get the following
error:

1067: Implicit coercion of a value of type flash.net:Responder to an
unrelated type mx.rpc:IResponder.

I'll see if I can figure that out, but AsyncTokens definitely don't seem to
like me.

Tref





[flexcoders] Re: Flex, SOAP and Process Flow

2010-01-19 Thread Amy


--- In flexcoders@yahoogroups.com, trefalgar trefal...@... wrote:

 I've given up for now. 
 
 AsyncTokens appear to be the way to go, but by the documentation I've seen it 
 *should* work, but the result/fault handlers are never hit. I decided to try 
 using 'closure' instead - I'm not even sure if the variables will remain 
 stateful, but it's at least in a forward direction for now.
 
 I think this is another case of the documentation being abysmally lacking.

I always use mx.rpc.Responder instead of AsyncResponder (is that a custom 
class?).  There's a working example of using AsyncToken with AMFPHP here 
http://flexdiary.blogspot.com/2009/01/lazy-loading-tree-example-file-posted.html
 .  Maybe that will help you see something the docs aren't showing you.

HTH;

Amy



[flexcoders] Re: Flex, SOAP and Process Flow

2010-01-19 Thread peeyushtuli
Asynctokens do work. I havent seen a single case of the handlers not being 
invoked being linked to some bug in flex sdk. Can you please post some code 
snippets of how exactly you used the asynctoken and mention the flex sdk?


--- In flexcoders@yahoogroups.com, trefalgar trefal...@... wrote:

 I've given up for now. 
 
 AsyncTokens appear to be the way to go, but by the documentation I've seen it 
 *should* work, but the result/fault handlers are never hit. I decided to try 
 using 'closure' instead - I'm not even sure if the variables will remain 
 stateful, but it's at least in a forward direction for now.
 
 I think this is another case of the documentation being abysmally lacking.
 
 Tref
 
 --- In flexcoders@yahoogroups.com, trefalgar trefalgar@ wrote:
 
  Yeap, looking at that now and having little luck as well.
  
  http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/Flex/Q_23313753.html,
   for example, shows someone with a similar problem with a similar solution. 
  Here's what I've got ...
  
  var myService:Statistics = new Statistics(null,endPoint);
  var token:AsyncToken = myService.disableStatistics(user,pass,email,tArray);
  token.email = email;
  token.addResponder(new AsyncResponder(myResults,myFaults,token)); 
  
  myResults and myFaults are never hit. If I use addEventListener against 
  myService instead, I get the resulting data, but nothing from the 
  token:AsyncToken. 
  
  I'm not comfortable that I have the AsyncToken set up properly, since it 
  doesnt make sense to make the call to myService before 'email' or 
  'addResponder' is issued, which is what I'm playing with right now.
  
  Treffy
  
  
  --- In flexcoders@yahoogroups.com, João Fernandes 
  joaopedromartinsfernandes@ wrote:
  
   You can add a responder to your AsyncToken which will carry your fault and
   result handlers.
   
   2010/1/18 trefalgar trefalgar@
   
   
   
For those wanting to follow this suggestion, there's a good example 
here:
http://livedocs.adobe.com/flex/3/html/help.html?content=data_4.html. 
It's
towards the bottom, Using a return token.
   
Unfortunately, this example doesn't appear to work for me. It uses the
Flex-built SOAP code and an AsyncToken to keep track of things. I don't 
have
a FaultEvent.FAULT or ResultEvent.RESULT option when adding an event
listener to my AsyncToken.
   
Back to the drawing board I go.
   
Jacob
   
   
--- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, João
Fernandes joaopedromartinsfernandes@ wrote:

  That said, since #2 doesn't tell me what user it's replying no to,
  if I do this in a loop with 100 users, it could be replying back 
  with
  20 nos and I can't tell how I'd match the replies up with the
requests.
 Yes you can, try using the asyncToken generated by
 service.invokeWs(user) and store your user in some property (eg.
 currentUser) , once you get the resultEvent, that AsyncToken will have
 the corresponding user stored (event.token.currentUser).

 --

 João Fernandes

 Adobe Certified Expert
 Adobe Community Expert
 http://www.twitter.com/joaofernandes
 http://www.riapt.org
 Portugal Adobe User Group (http://aug.riapt.org)

   
 
   
   
   
   
   -- 
   
   João Fernandes
  
 





[flexcoders] Re: Flex, SOAP and Process Flow

2010-01-19 Thread trefalgar
Thanks for this post. I thought I had updated to SDK 3.3, but it looks like my 
default was still 3.1. I updated Flex Builder to use the 3.3 SDK and I'll give 
it all a second try.

I'll also take a look at Amy's URL, to make sure I'm doing things in a kosher 
manner.

Tref

--- In flexcoders@yahoogroups.com, peeyushtuli peeyus...@... wrote:

 Asynctokens do work. I havent seen a single case of the handlers not being 
 invoked being linked to some bug in flex sdk. Can you please post some code 
 snippets of how exactly you used the asynctoken and mention the flex sdk?
 
 
 --- In flexcoders@yahoogroups.com, trefalgar trefalgar@ wrote:
 
  I've given up for now. 
  
  AsyncTokens appear to be the way to go, but by the documentation I've seen 
  it *should* work, but the result/fault handlers are never hit. I decided to 
  try using 'closure' instead - I'm not even sure if the variables will 
  remain stateful, but it's at least in a forward direction for now.
  
  I think this is another case of the documentation being abysmally lacking.
  
  Tref
  
  --- In flexcoders@yahoogroups.com, trefalgar trefalgar@ wrote:
  
   Yeap, looking at that now and having little luck as well.
   
   http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/Flex/Q_23313753.html,
for example, shows someone with a similar problem with a similar 
   solution. Here's what I've got ...
   
   var myService:Statistics = new Statistics(null,endPoint);
   var token:AsyncToken = 
   myService.disableStatistics(user,pass,email,tArray);
   token.email = email;
   token.addResponder(new AsyncResponder(myResults,myFaults,token)); 
   
   myResults and myFaults are never hit. If I use addEventListener against 
   myService instead, I get the resulting data, but nothing from the 
   token:AsyncToken. 
   
   I'm not comfortable that I have the AsyncToken set up properly, since it 
   doesnt make sense to make the call to myService before 'email' or 
   'addResponder' is issued, which is what I'm playing with right now.
   
   Treffy
   
   
   --- In flexcoders@yahoogroups.com, João Fernandes 
   joaopedromartinsfernandes@ wrote:
   
You can add a responder to your AsyncToken which will carry your fault 
and
result handlers.

2010/1/18 trefalgar trefalgar@



 For those wanting to follow this suggestion, there's a good example 
 here:
 http://livedocs.adobe.com/flex/3/html/help.html?content=data_4.html. 
 It's
 towards the bottom, Using a return token.

 Unfortunately, this example doesn't appear to work for me. It uses the
 Flex-built SOAP code and an AsyncToken to keep track of things. I 
 don't have
 a FaultEvent.FAULT or ResultEvent.RESULT option when adding an event
 listener to my AsyncToken.

 Back to the drawing board I go.

 Jacob


 --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, João
 Fernandes joaopedromartinsfernandes@ wrote:
 
   That said, since #2 doesn't tell me what user it's replying no 
   to,
   if I do this in a loop with 100 users, it could be replying back 
   with
   20 nos and I can't tell how I'd match the replies up with the
 requests.
  Yes you can, try using the asyncToken generated by
  service.invokeWs(user) and store your user in some property (eg.
  currentUser) , once you get the resultEvent, that AsyncToken will 
  have
  the corresponding user stored (event.token.currentUser).
 
  --
 
  João Fernandes
 
  Adobe Certified Expert
  Adobe Community Expert
  http://www.twitter.com/joaofernandes
  http://www.riapt.org
  Portugal Adobe User Group (http://aug.riapt.org)
 

  




-- 

João Fernandes
   
  
 





[flexcoders] Re: Flex, SOAP and Process Flow

2010-01-19 Thread trefalgar
--- In flexcoders@yahoogroups.com, Amy amyblankens...@... wrote:
 I always use mx.rpc.Responder instead of AsyncResponder (is that a custom 
 class?).  There's a working example of using AsyncToken with AMFPHP here 
 http://flexdiary.blogspot.com/2009/01/lazy-loading-tree-example-file-posted.html
  .  Maybe that will help you see something the docs aren't showing you.

Thanks for the tip, Amy, but it doesn't look any different than what I have. 
Additionally, I didnt see any change in behavior from SDK 3.1 to SDK 3.5.

Intentionally brief, here:

import mx.rpc.AsyncToken;
import mx.rpc.AsyncResponder;

var token:AsyncToken = myService.disableStatistics(user,pass,email,tArray);
token.info = email;
token.addResponder(new AsyncResponder(myResults,myFaults,token));

private function myResults(event:Object, token:AsyncToken):void {
var resultEvent:ResultEvent = ResultEvent(event);
}
private function myFaults(event:Object, token:AsyncToken):void {
var faultEvent:FaultEvent = FaultEvent(event);
}

disableStatistics is called, and executes correctly. I see the reply coming 
back in but neither myResults nor myFaults is ever called. If I add a listener 
...

myService.adddisableStatisticsEventListener(myResultHandlingFunction);

... the listener's result function is called, but I have no token data from the 
AsyncToken/AsyncResponder. 

Could the problem be due to AsyncTokens being used within the Flex generated 
coded based off the WSDL? ie, wrapping AsyncToken calls around other AsyncToken 
calls?

Tref



[flexcoders] Re: Flex, SOAP and Process Flow

2010-01-19 Thread trefalgar
--- In flexcoders@yahoogroups.com, trefalgar trefal...@... wrote:

 --- In flexcoders@yahoogroups.com, Amy amyblankenship@ wrote:
  I always use mx.rpc.Responder instead of AsyncResponder (is that a custom 
  class?).  There's a working example of using AsyncToken with AMFPHP here 
  http://flexdiary.blogspot.com/2009/01/lazy-loading-tree-example-file-posted.html
   .  Maybe that will help you see something the docs aren't showing you.
 
 var token:AsyncToken = myService.disableStatistics(user,pass,email,tArray);
 token.info = email;
 token.addResponder(new AsyncResponder(myResults,myFaults,token));

I forgot this little bit - using Responder over AsyncResponder. As far as I can 
tell, it's not a custom class as it's included by default in the SDK. 

As far as usage, if I use Responder over AsyncResponder, I get the following 
error:

1067: Implicit coercion of a value of type flash.net:Responder to an unrelated 
type mx.rpc:IResponder.

I'll see if I can figure that out, but AsyncTokens definitely don't seem to 
like me.

Tref



[flexcoders] Re: Flex, SOAP and Process Flow

2010-01-19 Thread Amy


--- In flexcoders@yahoogroups.com, trefalgar trefal...@... wrote:

 --- In flexcoders@yahoogroups.com, trefalgar trefalgar@ wrote:
 
  --- In flexcoders@yahoogroups.com, Amy amyblankenship@ wrote:
   I always use mx.rpc.Responder instead of AsyncResponder (is that a custom 
   class?).  There's a working example of using AsyncToken with AMFPHP here 
   http://flexdiary.blogspot.com/2009/01/lazy-loading-tree-example-file-posted.html
.  Maybe that will help you see something the docs aren't showing you.
  
  var token:AsyncToken = myService.disableStatistics(user,pass,email,tArray);
  token.info = email;
  token.addResponder(new AsyncResponder(myResults,myFaults,token));
 
 I forgot this little bit - using Responder over AsyncResponder. As far as I 
 can tell, it's not a custom class as it's included by default in the SDK. 

I've never used it, but I'm thinking it doesn't look as useful as a regular 
mx.rpc.Responder.  For one thing, it doesn't give you the 
ResultEvent/FaultEvent.  Instead, it gives you some odd sort of info object, 
that I wouldn't even know how to inspect, as no details are provided as to what 
that object will look like.

 As far as usage, if I use Responder over AsyncResponder, I get the following 
 error:
 
 1067: Implicit coercion of a value of type flash.net:Responder to an 
 unrelated type mx.rpc:IResponder.

Yeah, don't use flash.net.Responder.  Use mx.rpc.Responder.  That's why I 
included the full path.

 I'll see if I can figure that out, but AsyncTokens definitely don't seem to 
 like me.

Honestly, I'm not sure how it is that you don't see any difference between what 
I my example shows and what you're doing.  My fault/result method signatures 
are completely different--they have a different number of arguments and expect 
different data types.  These are the kind of details you need to train yourself 
to pick up on, or you're going to continue to find the documentation unhelpful.

Hope this clarifies;

Amy



[flexcoders] Re: Flex, SOAP and Process Flow

2010-01-18 Thread valdhor
Basically you wait for the resultevent of the first call and put the second 
call in that function.

--- In flexcoders@yahoogroups.com, trefalgar trefal...@... wrote:

 I've run into an odd problem that I haven't been able to find a solution to. 
 In other programming languages (Perl, PHP, for example), if I want to do X, Y 
 and Z in order, all with remote calls, it's very easy and straight forward. 
 With Flex, I'm pretty confused on how to do something this simple. Here's the 
 problem and why I'm confused ...
 
 I'm using Flex and SOAP to talk to a web interface. In order to get to step 
 Y, I have to first do step X. I can not skip to step Y without step X being 
 complete. But setting up the flow to be two subroutine calls, X first, then 
 Y, doesn't mean that X finishes first (and lately means Y actually finishes 
 first).
 
 callX(var1,var2);
 callY(var3,var4);
 
 Since Flex uses listeners, and not return() how do you pass data around to 
 know that X is complete? 
 
 callX(var1,var2);
 {wait for callX to be finished, before continuing}
 callY(var3,var4);
 
 How do you pass data around successfully to do that check? Does my problem 
 description make any sense or is my brain fried? ;)
 
 Treffy.





[flexcoders] Re: Flex, SOAP and Process Flow

2010-01-18 Thread trefalgar
That makes sense if you can control the data that is sent back to you from the 
first resultevent (but I can't).

1) Web call - Does the user 'Trefalgar' exist?
2) Web reply - No. (no additional data)
3) Web call - Create user 'Trefalgar'

Flex doesnt appear to be linear. That said, since #2 doesn't tell me what user 
it's replying no to, if I do this in a loop with 100 users, it could be 
replying back with 20 nos and I can't tell how I'd match the replies up with 
the requests.

Is there a solution for this problem in Flex/AS? I don't think putting the 
secondary calls in the resultevent would work, when critical information needed 
for future calls isn't available in the resultevent.

Tref


--- In flexcoders@yahoogroups.com, valdhor valdhorli...@... wrote:

 Basically you wait for the resultevent of the first call and put the second 
 call in that function.
 
 --- In flexcoders@yahoogroups.com, trefalgar trefalgar@ wrote:
 
  I've run into an odd problem that I haven't been able to find a solution 
  to. In other programming languages (Perl, PHP, for example), if I want to 
  do X, Y and Z in order, all with remote calls, it's very easy and straight 
  forward. With Flex, I'm pretty confused on how to do something this simple. 
  Here's the problem and why I'm confused ...
  
  I'm using Flex and SOAP to talk to a web interface. In order to get to step 
  Y, I have to first do step X. I can not skip to step Y without step X being 
  complete. But setting up the flow to be two subroutine calls, X first, then 
  Y, doesn't mean that X finishes first (and lately means Y actually finishes 
  first).
  
  callX(var1,var2);
  callY(var3,var4);
  
  Since Flex uses listeners, and not return() how do you pass data around to 
  know that X is complete? 
  
  callX(var1,var2);
  {wait for callX to be finished, before continuing}
  callY(var3,var4);
  
  How do you pass data around successfully to do that check? Does my problem 
  description make any sense or is my brain fried? ;)
  
  Treffy.
 





Re: [flexcoders] Re: Flex, SOAP and Process Flow

2010-01-18 Thread João Fernandes
 That said, since #2 doesn't tell me what user it's replying no to, 
 if I do this in a loop with 100 users, it could be replying back with 
 20 nos and I can't tell how I'd match the replies up with the requests.
Yes you can, try using the asyncToken generated by 
service.invokeWs(user) and store your user in some property (eg. 
currentUser) , once you get the resultEvent, that AsyncToken will have 
the corresponding user stored (event.token.currentUser).

-- 

João Fernandes

Adobe Certified Expert
Adobe Community Expert
http://www.twitter.com/joaofernandes
http://www.riapt.org
Portugal Adobe User Group (http://aug.riapt.org)





[flexcoders] Re: Flex, SOAP and Process Flow

2010-01-18 Thread trefalgar
That's interesting. It seems that the WSDL Importer uses AsyncTokens all over 
the place, but I never see any of them in the variables during a debug session. 
I'm now questioning if the importer actually made everything more complex than 
it needed to be ;)

Thanks for the tip, João. I'm going to see if I can figure it out.

Tref

--- In flexcoders@yahoogroups.com, João Fernandes 
joaopedromartinsfernan...@... wrote:
 Yes you can, try using the asyncToken generated by 
 service.invokeWs(user) and store your user in some property (eg. 
 currentUser) , once you get the resultEvent, that AsyncToken will have 
 the corresponding user stored (event.token.currentUser).
 
 -- 
 
 João Fernandes
 
 Adobe Certified Expert
 Adobe Community Expert
 http://www.twitter.com/joaofernandes
 http://www.riapt.org
 Portugal Adobe User Group (http://aug.riapt.org)





[flexcoders] Re: Flex, SOAP and Process Flow

2010-01-18 Thread trefalgar
For those wanting to follow this suggestion, there's a good example here: 
http://livedocs.adobe.com/flex/3/html/help.html?content=data_4.html. It's 
towards the bottom, Using a return token.

Unfortunately, this example doesn't appear to work for me. It uses the 
Flex-built SOAP code and an AsyncToken to keep track of things. I don't have a 
FaultEvent.FAULT or ResultEvent.RESULT option when adding an event listener to 
my AsyncToken.

Back to the drawing board I go.

Jacob

--- In flexcoders@yahoogroups.com, João Fernandes 
joaopedromartinsfernan...@... wrote:

  That said, since #2 doesn't tell me what user it's replying no to, 
  if I do this in a loop with 100 users, it could be replying back with 
  20 nos and I can't tell how I'd match the replies up with the requests.
 Yes you can, try using the asyncToken generated by 
 service.invokeWs(user) and store your user in some property (eg. 
 currentUser) , once you get the resultEvent, that AsyncToken will have 
 the corresponding user stored (event.token.currentUser).
 
 -- 
 
 João Fernandes
 
 Adobe Certified Expert
 Adobe Community Expert
 http://www.twitter.com/joaofernandes
 http://www.riapt.org
 Portugal Adobe User Group (http://aug.riapt.org)





Re: [flexcoders] Re: Flex, SOAP and Process Flow

2010-01-18 Thread João Fernandes
You can add a responder to your AsyncToken which will carry your fault and
result handlers.

2010/1/18 trefalgar trefal...@yahoo.com



 For those wanting to follow this suggestion, there's a good example here:
 http://livedocs.adobe.com/flex/3/html/help.html?content=data_4.html. It's
 towards the bottom, Using a return token.

 Unfortunately, this example doesn't appear to work for me. It uses the
 Flex-built SOAP code and an AsyncToken to keep track of things. I don't have
 a FaultEvent.FAULT or ResultEvent.RESULT option when adding an event
 listener to my AsyncToken.

 Back to the drawing board I go.

 Jacob


 --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, João
 Fernandes joaopedromartinsfernan...@... wrote:
 
   That said, since #2 doesn't tell me what user it's replying no to,
   if I do this in a loop with 100 users, it could be replying back with
   20 nos and I can't tell how I'd match the replies up with the
 requests.
  Yes you can, try using the asyncToken generated by
  service.invokeWs(user) and store your user in some property (eg.
  currentUser) , once you get the resultEvent, that AsyncToken will have
  the corresponding user stored (event.token.currentUser).
 
  --
 
  João Fernandes
 
  Adobe Certified Expert
  Adobe Community Expert
  http://www.twitter.com/joaofernandes
  http://www.riapt.org
  Portugal Adobe User Group (http://aug.riapt.org)
 

  




-- 

João Fernandes


[flexcoders] Re: Flex, SOAP and Process Flow

2010-01-18 Thread trefalgar
Yeap, looking at that now and having little luck as well.

http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/Flex/Q_23313753.html,
 for example, shows someone with a similar problem with a similar solution. 
Here's what I've got ...

var myService:Statistics = new Statistics(null,endPoint);
var token:AsyncToken = myService.disableStatistics(user,pass,email,tArray);
token.email = email;
token.addResponder(new AsyncResponder(myResults,myFaults,token)); 

myResults and myFaults are never hit. If I use addEventListener against 
myService instead, I get the resulting data, but nothing from the 
token:AsyncToken. 

I'm not comfortable that I have the AsyncToken set up properly, since it doesnt 
make sense to make the call to myService before 'email' or 'addResponder' is 
issued, which is what I'm playing with right now.

Treffy


--- In flexcoders@yahoogroups.com, João Fernandes 
joaopedromartinsfernan...@... wrote:

 You can add a responder to your AsyncToken which will carry your fault and
 result handlers.
 
 2010/1/18 trefalgar trefal...@...
 
 
 
  For those wanting to follow this suggestion, there's a good example here:
  http://livedocs.adobe.com/flex/3/html/help.html?content=data_4.html. It's
  towards the bottom, Using a return token.
 
  Unfortunately, this example doesn't appear to work for me. It uses the
  Flex-built SOAP code and an AsyncToken to keep track of things. I don't have
  a FaultEvent.FAULT or ResultEvent.RESULT option when adding an event
  listener to my AsyncToken.
 
  Back to the drawing board I go.
 
  Jacob
 
 
  --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, João
  Fernandes joaopedromartinsfernandes@ wrote:
  
That said, since #2 doesn't tell me what user it's replying no to,
if I do this in a loop with 100 users, it could be replying back with
20 nos and I can't tell how I'd match the replies up with the
  requests.
   Yes you can, try using the asyncToken generated by
   service.invokeWs(user) and store your user in some property (eg.
   currentUser) , once you get the resultEvent, that AsyncToken will have
   the corresponding user stored (event.token.currentUser).
  
   --
  
   João Fernandes
  
   Adobe Certified Expert
   Adobe Community Expert
   http://www.twitter.com/joaofernandes
   http://www.riapt.org
   Portugal Adobe User Group (http://aug.riapt.org)
  
 
   
 
 
 
 
 -- 
 
 João Fernandes





[flexcoders] Re: Flex, SOAP and Process Flow

2010-01-18 Thread Ariel J
I use the Operation classes from the MVCS architecture from Joe Berkowitz to 
group the series of external calls, for each user in your case.

--- In flexcoders@yahoogroups.com, trefalgar trefal...@... wrote:

 I've run into an odd problem that I haven't been able to find a solution to. 
 In other programming languages (Perl, PHP, for example), if I want to do X, Y 
 and Z in order, all with remote calls, it's very easy and straight forward. 
 With Flex, I'm pretty confused on how to do something this simple. Here's the 
 problem and why I'm confused ...
 
 I'm using Flex and SOAP to talk to a web interface. In order to get to step 
 Y, I have to first do step X. I can not skip to step Y without step X being 
 complete. But setting up the flow to be two subroutine calls, X first, then 
 Y, doesn't mean that X finishes first (and lately means Y actually finishes 
 first).
 
 callX(var1,var2);
 callY(var3,var4);
 
 Since Flex uses listeners, and not return() how do you pass data around to 
 know that X is complete? 
 
 callX(var1,var2);
 {wait for callX to be finished, before continuing}
 callY(var3,var4);
 
 How do you pass data around successfully to do that check? Does my problem 
 description make any sense or is my brain fried? ;)
 
 Treffy.





[flexcoders] Re: Flex, SOAP and Process Flow

2010-01-18 Thread trefalgar
I've given up for now. 

AsyncTokens appear to be the way to go, but by the documentation I've seen it 
*should* work, but the result/fault handlers are never hit. I decided to try 
using 'closure' instead - I'm not even sure if the variables will remain 
stateful, but it's at least in a forward direction for now.

I think this is another case of the documentation being abysmally lacking.

Tref

--- In flexcoders@yahoogroups.com, trefalgar trefal...@... wrote:

 Yeap, looking at that now and having little luck as well.
 
 http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/Flex/Q_23313753.html,
  for example, shows someone with a similar problem with a similar solution. 
 Here's what I've got ...
 
 var myService:Statistics = new Statistics(null,endPoint);
 var token:AsyncToken = myService.disableStatistics(user,pass,email,tArray);
 token.email = email;
 token.addResponder(new AsyncResponder(myResults,myFaults,token)); 
 
 myResults and myFaults are never hit. If I use addEventListener against 
 myService instead, I get the resulting data, but nothing from the 
 token:AsyncToken. 
 
 I'm not comfortable that I have the AsyncToken set up properly, since it 
 doesnt make sense to make the call to myService before 'email' or 
 'addResponder' is issued, which is what I'm playing with right now.
 
 Treffy
 
 
 --- In flexcoders@yahoogroups.com, João Fernandes 
 joaopedromartinsfernandes@ wrote:
 
  You can add a responder to your AsyncToken which will carry your fault and
  result handlers.
  
  2010/1/18 trefalgar trefalgar@
  
  
  
   For those wanting to follow this suggestion, there's a good example here:
   http://livedocs.adobe.com/flex/3/html/help.html?content=data_4.html. It's
   towards the bottom, Using a return token.
  
   Unfortunately, this example doesn't appear to work for me. It uses the
   Flex-built SOAP code and an AsyncToken to keep track of things. I don't 
   have
   a FaultEvent.FAULT or ResultEvent.RESULT option when adding an event
   listener to my AsyncToken.
  
   Back to the drawing board I go.
  
   Jacob
  
  
   --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, João
   Fernandes joaopedromartinsfernandes@ wrote:
   
 That said, since #2 doesn't tell me what user it's replying no to,
 if I do this in a loop with 100 users, it could be replying back with
 20 nos and I can't tell how I'd match the replies up with the
   requests.
Yes you can, try using the asyncToken generated by
service.invokeWs(user) and store your user in some property (eg.
currentUser) , once you get the resultEvent, that AsyncToken will have
the corresponding user stored (event.token.currentUser).
   
--
   
João Fernandes
   
Adobe Certified Expert
Adobe Community Expert
http://www.twitter.com/joaofernandes
http://www.riapt.org
Portugal Adobe User Group (http://aug.riapt.org)
   
  

  
  
  
  
  -- 
  
  João Fernandes