Ah, good find.  HTTPService won't support setCredentials without the
proxy, we need to prevent that error from coming through.  When you
don't use the proxy the only way you can send credentials to your
service is via HTTP authentication which means that the browser will pop
up its dialog, you can't do custom because the Player doesn't allow us
to assign the Authorization header.

I'll file a bug about the error.

Matt

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Avi Flax
Sent: Monday, February 06, 2006 8:10 AM
To: [email protected]
Subject: [flexcoders] Flex2 Beta1: Trouble with
HTTPService.setCredentials()

I'd like to create a Flex2 app that can access a REST API using Basic
HTTP Authentication.

I'm using the latest beta.

So, here's my test code:


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml";
xmlns="*" layout="absolute" backgroundColor="#ffffff"
creationComplete="httpService.setCredentials('[EMAIL PROTECTED]',
'password');httpService.send();">
    <mx:HTTPService id="httpService" url="http://www.aviflax.com/feed";
useProxy="false" resultFormat="text"/>
    <mx:Text id="text1" x="0" y="0" width="100%" height="100%"
text="{httpService.result.toString()}"/>
</mx:Application>



If I remove the setCredentials() call, it works fine.
If I add it, then the send() method throws this error:


TypeError: Error #1034: Type Coercion failed: cannot convert
C:\dev\enterprise_beta1\frameworks\libs\framework.swc(mx/core/mx_interna
l)$34::[EMAIL PROTECTED]
to
C:\dev\enterprise_beta1\frameworks\libs\framework.swc(mx/validators/Vali
dator)$132.DirectHTTPMessageResponder
    at
mx.messaging.channels::DirectHTTPChannel/mx.messaging.channels:DirectHTT
PChannel::internalSend()
    at mx.messaging::Channel/setCredentials()
    at mx.messaging::ChannelSet/setCredentials()
    at mx.messaging::MessageAgent/set channelSet()
    at mx.rpc.http::HTTPService/send()
    at mx.rpc.http.mxml::HTTPService/send()
    at pxQuoteClientMockup/___Application1_creationComplete()
    at flash.events::EventDispatcher/dispatchEvent()
    at
mx.core::UIComponent/mx.core:UIComponent::dispatchCreationCompleteEvent(
)
    at
mx.core::UIComponent$/http://www.macromedia.com/2005/flex/mx/internal::d
ispatchCreationCompleteEvents()
    at
mx.managers::LayoutManager/mx.managers:LayoutManager::doPhasedInstantiat
ion()
    at mx.core::UIComponent/mx.core:UIComponent::callLaterDispatcher2()
    at mx.core::UIComponent/mx.core:UIComponent::callLaterDispatcher()


I posted at the Adobe Labs Forums but (as usual) got no helpful
answers - just a confirmation from someone else having the same problem:

http://www.macromedia.com/cfusion/webforums/forum/messageview.cfm?catid=
584&threadid=1113869

Help!

Thanks,
Avi Flax
Arc 90
New York






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



 




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