Yes, I was doing it differently. Before calling the send method, I 
was trying to set the credentials using the setUsernamePassword 
method. With the way you are doing it below, you can only set 
credentials if you get a fault 401 error. This means that the first 
cedentials that work will always be used by the proxy. Maybe that 
is by design?

Bill

--- In [email protected], "t0mruggles" <[EMAIL PROTECTED]> 
wrote:
> 
> Hi Bill,
> 
> I just retested your scenario and am unable to produce your 
results. 
> Please see my code and service below. I've tried with 1.5 final 
and 
> with both HS and WS and all work for me for a Flex app contacting 
an 
> IIS secured resource hosted on a different server. Every time I 
run 
> this file I see the same expected results indicating that the 
first 
> request is denied with a 401 until credentials are set.
> 
> Are you doing something differently?
> 
> Tom Ruggles
> Macromedia Flex QA
> 
> 
> <?xml version="1.0" encoding="iso-8859-1"?>
> <mx:Application initialize="appLoaded()" 
> xmlns:mx="http://www.macromedia.com/2003/mxml";>
> 
> <mx:HTTPService id="hs" 
> serviceName="secureIISEchoServiceDynamic" 
> fault="serviceFault(event.fault);"
> result="serviceLoaded()"
> resultFormat="text">
> </mx:HTTPService>
> 
> 
> <mx:Script>
> <![CDATA[
> function appLoaded() {
> expected.text="Service fault: 401. \nService 
> loaded. "; 
> hs.send(); 
> }
> 
> function serviceFault(fault) {
> if (fault.faultcode == "Client.Authentication" || 
> fault.faultcode =="401") { // former is for WS
> hs.setUsernamePassword("bob", "bob"); 
> hs.send(); 
> }
> actual.text=actual.text + "Service fault: " + 
> fault.faultcode + ". \n";
> }
> 
> function serviceLoaded() {
> actual.text=actual.text + "Service loaded. \n";
> }
> ]]>
> </mx:Script>
> 
> <mx:VBox >
> <mx:HBox>
> <mx:Label text="Expected"/>
> <mx:TextArea id="expected" width="300" height="80"/>
> </mx:HBox>
> <mx:HBox>
> <mx:Label text="Actual"/>
> <mx:TextArea id="actual" width="300" height="80" />
> </mx:HBox>
> <mx:HBox>
> <mx:Button label="Run again" click="appLoaded();"/>
> </mx:HBox>
> 
> </mx:VBox>
> 
> </mx:Application>
> 
> 
> Named HTTP Service:
> <service name="secureIISEchoServiceDynamic">
> <url>http://myservicehost/secureAsmx/simple.asmx?
> wsdl</url>
> <use-custom-authentication>true</use-custom-
> authentication>
> </service> 
> 
> 
> 
> --- In [email protected], "billheit" <[EMAIL PROTECTED]> 
wrote:
> > 
> > Yes I had the problem in 1.0. Then I upgraded to 1.5, hoping to 
> fix 
> > the problem, but it didn't. I am still having the same issue. 
It 
> > seems that what ever credentials are first used to log into the 
web 
> > service are then continued to be used until the Flex server is 
> > bounced.
> > 
> > Bill
> > 
> > --- In [email protected], Matt Chotin <[EMAIL PROTECTED]> 
wrote:
> > > You're using Flex 1.5 right? Not 1.0? Apparently we had a 
bug 
> in 
> > 1.0 that
> > > showed itself like this. In 1.5 it was hopefully fixed, but 
you 
> > could also
> > > try to set <max-connections>0</max-connections> in flex-
> config.xml 
> > for the
> > > right service.
> > > 
> > > 
> > > 
> > > Matt
> > > 
> > > 
> > > 
> > > _____ 
> > > 
> > > From: billheit [mailto:[EMAIL PROTECTED] 
> > > Sent: Wednesday, March 02, 2005 5:36 PM
> > > To: [email protected]
> > > Subject: [flexcoders] Web Service Authentication
> > > 
> > > 
> > > 
> > > 
> > > I have a .NET web service that allows access to various levels 
of 
> > > resources (data) depending on what user logs into IIS using 
Basic 
> > > authentication.
> > > 
> > > In my Flex application, which is not running on the same 
server 
> as 
> > > my web service, I would like to have the user login with a 
user 
> > name 
> > > and password. Then pass these credentials along to the .NET 
web 
> > > service. I don't care if the flex app itself is secure; it is 
> > only 
> > > the web service that has sensitive data.
> > > 
> > > I have tried to use named HttpService and assign the user's 
> > > credentials using the setUsernamePassword method but it 
doesn't 
> > seem 
> > > to work after the first use. Once the proxy connects to the 
web 
> > > service, it seems to keep the same connection credentials.
> > > 
> > > Does anyone know of a better way to pass along the user's 
> > > credentials? Or does anyone have a better idea on how to do 
> this?
> > > 
> > > Thanks,
> > > 
> > > Bill
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > Yahoo! Groups Sponsor
> > > 
> > > 
> > > 
> > > ADVERTISEMENT
> > > 
> > > 
> > 
> 
<http://us.ard.yahoo.com/SIG=129qnatho/M=298184.6018725.7038619.30011
> > 76/D=gr
> > > 
> > 
> 
oups/S=1705007207:HM/EXP=1109889378/A=2593423/R=0/SIG=11el9gslf/*http
> > :/www.n
> > > etflix.com/Default?mqso=60190075> click here
> > > 
> > > 
> > > 
> > > <http://us.adserver.yahoo.com/l?
> > M=298184.6018725.7038619.3001176/D=groups/S=
> > > :HM/A=2593423/rand=138851879> 
> > > 
> > > 
> > > 
> > > _____ 
> > > 
> > > Yahoo! Groups Links
> > > 
> > > * To visit your group on the web, go to:
> > > http://groups.yahoo.com/group/flexcoders/
> > > <http://groups.yahoo.com/group/flexcoders/> 
> > > 
> > > * To unsubscribe from this group, send an email to:
> > > [EMAIL PROTECTED]
> > > <mailto:[EMAIL PROTECTED]
> > subject=Unsubscribe> 
> > > 
> > > * Your use of Yahoo! Groups is subject to the Yahoo!
> > > <http://docs.yahoo.com/info/terms/> Terms of Service.





Reply via email to