The only way you can do this is through the proxy, unfortunately. I don't know 
if this is a limitation of the player or the flex framework. I have only been 
able to coax basic auth using the Socket class but that clearly won't work with 
web services. 


Carson



-----Original Message-----
From: [email protected] <[email protected]>
To: [email protected] <[email protected]>
Sent: Thu Dec 14 18:27:13 2006
Subject: [flexcoders] Re: HTTP Header Web Service Authentication

Dave,

I understand that. I need to authenticate using BASIC authentication.
I have form inputs where the user enters their user name and
password. I then use base64 and encode it.

I am stuck at this point. How can I add in an HTTP header that
includes the encoded authorization string?

This is my current web service call:

private function init():void{
var ws:WebService = new WebService;
var qname:QName = new QName(null, "Authorization");
var str:String = new String("Basic Y2xhcnVzYWRtaW46Y2xhcnVzYWRtaW4=");
var header:SOAPHeader = new SOAPHeader(qname, str);

ws.useProxy = false;

ws.addHeader(header);ws.loadWSDL("http://sc-vmx-03:4040/clarusipc/services/InventoryService?wsdl
 <http://sc-vmx-03:4040/clarusipc/services/InventoryService?wsdl> ");
ws.makeObjectsBindable = true;

var op:Operation = ws.getOperation("getPhoneCount") as Operation;
op.arguments.projectId = 1;
op.addEventListener("result", resultHandler);
op.addEventListener("fault", faultHandler);
op.resultFormat= "e4x"; 

var call:AsyncToken = op.send();
}

As you can see, I can easily add a SOAP header to the request. 
However, this is of no use to me – I need to send a HTTP Basic
authorization header.

The header should be in the format "Authorization = Basic
Y2xhcnVzYWRtaW46Y2xhcnVzYWRtaW4=".

Is this possible? If so, can you provide an example that illustrates
how to add a custom HTTP header into a web service request? 

Thanks,
Phil

--- In [email protected] <mailto:flexcoders%40yahoogroups.com> , "Dave 
Wolf" <[EMAIL PROTECTED]> wrote:
>
> 
> What exactly are you trying to do. You can secure web service calls
> using standard HTTP authentication headers. We do this with both
> BASIC and FORM auth.
> 
> -- 
> Dave Wolf
> Cynergy Systems, Inc.
> Adobe Flex Alliance Partner
> http://www.cynergysystems.com <http://www.cynergysystems.com> 
> http://www.cynergysystems.com/blogs <http://www.cynergysystems.com/blogs> 
> 
> Email: [EMAIL PROTECTED]
> Office: 866-CYNERGY
> 
> --- In [email protected] <mailto:flexcoders%40yahoogroups.com> , 
> "phipzkillah" <pkrasko@> wrote:
> >
> > Does anyone know if it's possible to add a custom HTTP header to the
> > web service request?
> > 
> > All authentication methods described through Flex seem to be oriented
> > around SOAP headers.
> > 
> > Can we authenticate a web service through HTTP headers?
> > 
> > This has been driving me crazy for the past few days. Any ideas or
> > suggestions??
> > 
> > -phil
> >
>



 

Reply via email to