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/[email protected]/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:

<?xml version="1.0" encoding="utf-8"?>
<cairngorm:ServiceLocator xmlns:mx="http://www.macromedia.com/2003/mxml";
                    
xmlns:cairngorm="http://www.iterationtwo.com/cairngorm";>

    <mx:HTTPService id="loginService" url="login.jsp"
showBusyCursor="true"
                    useProxy="false" result="onResult(event)"
fault="event.call.faultHandler(event)"  method="POST">
      <mx:request>
       <username>test</username>
       <password>asd</password>
      </mx:request>
    </mx:HTTPService>

    <mx:Script>
     public function onResult( event : Object ) : Void
     {
        mx.core.Application.alert(event.call);
     }
    </mx:Script>

</cairngorm:ServiceLocator>

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?






------------------------ 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/
 


Reply via email to