Eric, the call property is an object that is returned by the send
method, and has accepted anything I have tried to put in it. Because I
have not yet become comfortable with the idea of a function as an
object, I have never tried, but the call property should hold a function
object just fine.
I don't use Cairngorm, but use HTTPService almost exclusively. You'll
need to translate anything I say into Cairngormese.
I don't think you want to put the result and fault handlers in the
request object, rather on the call object.
As I said, I don't do this, rather I send a string that identifies the
call ans use a switch to send it to the correct handler.
oCall = myHttpService.send(oRequestObject);
oCall.requestName = "whatever";
And in onResult,
var sRequestName:String = result.call.requestName; //
switch(sRequestName){
case " whatever ":
...
Since call is an object, you should be able to do this:
oCall.resultHandler = Delegate.create(this, onResult);
I'm not sure how you would invoke the function in onResult though.
Tracy
-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Eric Raymond
Sent: Wednesday, September 14, 2005 1:43 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Cairngorm and HttpService breaks event.call
I'm trying to get Cairngorm to work with HttpServices. It appears
that "event.call.resultHandler" on the service handler does not work
with HttpServices.
Has anyone gotten this to work? It looks like it is not possible
given my results below. The call property is a urlencoded parameter
string ... not an object which can hold an event handler function.
FYI, a prior thread suggests that it does work:
http://www.mail-archive.com/flexcoders@yahoogroups.com/msg06287.html
In the case below the event.call object is a string with value
"password=asd&username=test". Works the same if you use send(request)
where request is an object with properties password and username.
If you add resultHandler/faultHandler delegates to the request object
*before* the send, they will show up appended with &'s in the call
string ... with the function object turned into a text representation.
Not surprisingly, this doesn't work too well. Setting properties on
the result of the send() appears to have no effect no matter when you
set them.
var call =
ServiceLocator.getInstance().getService("loginService");
var request = {username: "test", password: "asd"};
request.resultHandler = Delegate.create(this, this.onResult);
request.faultHandler = Delegate.create(this, this.onFault);
call.send(request);
So can this be made to work for HttpServices? The last thing for me
to try is to enable the proxy in the service, but I wouldn't expect
that to change anything (and we aren't in a situation where we want to
use the proxy).
Here's my test case:
http://www.macromedia.com/2003/mxml";
xmlns:cairngorm="http://www.iterationtwo.com/cairngorm";>
test
asd
public function onResult( event : Object ) : Void
{
mx.core.Application.alert(event.call);
}
I'm guessing that HttpServices are a quiet backwater of the framework
and don't get much use.
I have an idea of a workaround, but it's a hack. Attach a unique
identifier to the request which can be mapped to the proper event
callback delegate. The service callback will call a function which
looks up the delegate via the id and calls it with the event. Short
of getting event.call to work, is there another workaround?
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
Yahoo! Groups Sponsor ~-->
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/nhFolB/TM
~->
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/