jeudi 16 mars 2017

change protocol of endpoint in AMFChannel, how to fix it?

I am working on Flex and I find that when I give uri( to AMFChannel which content 'HTTPS' protocal but calculateEndpoint() method of Channel class change protocol from "HTTPS" to "HTTP".

I also made simple project to demonstrate how endpoint gets changed by AMFChannel.

<?xml version="1.0"?>
<s:Application xmlns:fx="" xmlns:s="library://">
    import mx.controls.Alert;
    import mx.messaging.ChannelSet;
    import mx.messaging.channels.AMFChannel;
    import mx.rpc.AbstractOperation;
    import mx.rpc.remoting.mxml.RemoteObject;

    private function button1_clickHandler(event:MouseEvent):void
        var amfChannelWeb:AMFChannel = new AMFChannel("amfChannel", txtInput.text);

        var remoteObj:RemoteObject = new RemoteObject();
        remoteObj.showBusyCursor = true;
        remoteObj.requestTimeout = 0;

        var channelSet = new ChannelSet();
        channelSet.channels = [amfChannelWeb];

        remoteObj.destination = "amfphp";
        remoteObj.channelSet = channelSet;

        var op:AbstractOperation = remoteObj.getOperation("testAmfData");
        op.addEventListener("result", resultHandler);
        op.addEventListener("fault", resultFaultHandler);
        lblEndpoint.text = amfChannelWeb.endpoint;

    private function resultHandler(e:Event):void
        lblChannelError.text = e.toString();

    private function resultFaultHandler(e:Event):void
        lblChannelError.text = e.toString();

<s:VGroup width="100%">

    <s:TextInput width="80%" id="txtInput" text=""/>
    <s:Button click="button1_clickHandler(event)" label="Click"/>
    <s:Label id="lblEndpoint"/>
    <s:Label id="lblChannelError"/>


Is this issue or am I doing somthing wrong??

Aucun commentaire:

Enregistrer un commentaire