tags:

views:

253

answers:

3

Yesterday I spent half of day trying to force Flex Remoting to use HTTPS with no success.

Today I tried to connect to other domain. I changed url of endpoint, but it looks like flex just ignores my changes. I am sure that an old url doesn't exist in any file in src directory, I even renamed services-config.xml to services-config2.xml, cleaned and rebuilded project many times, even made a release build, but it still connects to the same domain.

I have tested flex application in localhost and in the same domain, that has AMF services, but it works in the same way.

My services-config.xml is:

<?xml version="1.0" encoding="UTF-8"?>
<services-config>
    <services>
        <service id="amfphp-flashremoting-service" class="flex.messaging.services.RemotingService" messageTypes="flex.messaging.messages.RemotingMessage">
            <destination id="amfphp">
                <channels>
                    <channel ref="my-amfphp-secure"/>
                    <channel ref="my-amfphp"/>
                </channels>
                <properties>
                    <source>*</source>
                </properties>
            </destination>
        </service>
    </services>
    <channels>
        <channel-definition id="my-amfphp-secure" class="mx.messaging.channels.SecureAMFChannel">
            <endpoint uri="https://xxx.dev.company.com:443/AMF" class="flex.messaging.endpoints.SecureAMFEndpoint"/>
            <properties>
                <polling-enabled>false</polling-enabled>
                <serialization>
                    <instantiate-types>false</instantiate-types>
                    <log-property-errors>true</log-property-errors>
                </serialization>
                <add-no-cache-headers>false</add-no-cache-headers>
            </properties>
        </channel-definition>
        <channel-definition id="my-amfphp" class="mx.messaging.channels.AMFChannel" >
            <endpoint uri="http://xxx.dev.company.com/AMF" class="flex.messaging.endpoints.AMFEndpoint" />
            <properties>
                <polling-enabled>false</polling-enabled>
                <serialization>
                    <instantiate-types>false</instantiate-types>
                    <log-property-errors>true</log-property-errors>
                </serialization>
                <add-no-cache-headers>false</add-no-cache-headers>
            </properties>
        </channel-definition>
    </channels>
</services-config>

RemoteObject definition in mxml:

<mx:RemoteObject id="Agentrpc" destination="amfphp" source="Agentrpc" showBusyCursor="true">
    <mx:method name="getAgentID" result="getAgentID_resultHandler(event)" fault="faultHandler(event)"/>
</mx:RemoteObject>

I'm using Flex 3.

Edit: I took a look at generated/ dir and I see that FlexInit files (like MainModule_FlexInit-generated.as) contains code:

ServerConfig.xml =
<services>
    <service id="amfphp-flashremoting-service">
        <destination id="amfphp">
            <channels>
                <channel ref="my-amfphp-secure"/>
                <channel ref="my-amfphp"/>
            </channels>
        </destination>
    </service>
    <channels>
        <channel id="my-amfphp-secure" type="mx.messaging.channels.SecureAMFChannel">
            <endpoint uri="https://gintautas.dev.company.com:443/AMF"/&gt;
            <properties>
                <polling-enabled>false</polling-enabled>
            </properties>
        </channel>
        <channel id="my-amfphp" type="mx.messaging.channels.AMFChannel">
            <endpoint uri="http://gintautas.dev.company.com/AMF"/&gt;
            <properties>
                <polling-enabled>false</polling-enabled>
            </properties>
        </channel>
    </channels>
</services>;

That's correct, but application doesn't make requests to gintautas.dev.company.com

Edit 2: I installed Flash Builder 4 and tried to compile using 3.5 and 4.0(in compatibility mode) compilers, but both has the same problem :(

A: 

Can you try to clear your browser cache ? The content of the services.xml is injected into the SWF at compile time.

Cornel Creanga
Allready tried that. Cache is totally disabled by Web Developer plugin in Firefox, all files are downloaded everytime/
Naktibalda
All of a sudden it started working, probably because I made a copy of project and changed workspace.
Naktibalda
+1  A: 

you can check what is being compiled into flex from the *-config.XML files with the following:

trace( ServerConfig.XML );

Also, if using WTP with tomcat, check if server is using the actual installation of tomcat, or a temp eclipse folder to run. that can sometimes cause mix ups.

David Collie
David, thanks for that tip. Having similar trouble to the original post - being able to see what has ostensibly been compiled is a realy nice thing. +1
Ross Henderson