basic authentification on air

8 views
Skip to first unread message

cholid ridwan

unread,
Aug 30, 2010, 12:32:09 AM8/30/10
to flex_...@googlegroups.com, flexviz...@googlegroups.com
i try to get some property of an object with xmlrpc
and it's work
then i adopt the code to air application
when it run, then show a login window that is not happen in flex application
it says
"The Server admin (on port 0) requires a username and password"
"this server uses 'basic' authentification"
username:
password:

are there has a different from air and flex code on handle authentification methode?
thanks


this the code;

    creationComplete="init()" layout="absolute">
.................
            import com.ak33m.rpc.xmlrpc.XMLRPCConnection;
            import mx.rpc.Fault;
            import com.ak33m.rpc.xmlrpc.XMLRPCObject;
            import mx.utils.Base64Encoder;
            import mx.utils.ArrayUtil;
            import mx.collections.ArrayCollection;
            import mx.rpc.events.ResultEvent;
            import mx.rpc.events.FaultEvent;
            import mx.rpc.AsyncToken;
            import mx.controls.Alert;
            import mx.collections.ItemResponder;
           
            [Bindable] public var returnedData:ArrayCollection;
            [Bindable] public var serviceEndpoint:String="http://admin:admin@localhost:8080";
            public var service:XMLRPCObject;
                       
            public function init():void
            {
                service = new XMLRPCObject();
                service.endpoint = serviceEndpoint;
                service.destination = "/zport/dmd";
                service.addEventListener(FaultEvent.FAULT, onFault);
                service.addEventListener(ResultEvent.RESULT, onResult);
            }
            public function onResult(event:ResultEvent):void
            {
                Alert.show(String(event.result));
            }
            public function onFault(event:FaultEvent):void
            {
                Alert.show(event.fault.faultString, event.fault.faultCode);
            }
            public function getId():void
            {
                service.call("getProductName");
            }
...............
    <mx:Button click="getId()" label="Get ID" width="100%"/>
..........
</mx:WindowedApplication>

Reply all
Reply to author
Forward
0 new messages