【问题标题】:Flex ignores changes in services-config.xmlFlex 忽略 services-config.xml 中的更改
【发布时间】:2010-06-22 08:51:41
【问题描述】:

昨天我花了半天时间试图强制 Flex Remoting 使用 HTTPS,但没有成功。

今天我尝试连接到其他域。 我更改了端点的 url,但看起来 flex 只是忽略了我的更改。 我确信 src 目录中的任何文件中都不存在旧的 url, 我什至将 services-config.xml 重命名为 services-config2.xml,多次清理和重建项目,甚至进行了发布构建,但它仍然连接到同一个域。

我已经在 localhost 和同一域中测试了具有 AMF 服务的 flex 应用程序,但它的工作方式相同。

我的 services-config.xml 是:

<?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>

mxml中的RemoteObject定义:

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

我正在使用 Flex 3。

编辑:我查看了 generated/ 目录,发现 FlexInit 文件(如 MainModule_FlexInit-generated.as)包含代码:

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"/>
            <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"/>
            <properties>
                <polling-enabled>false</polling-enabled>
            </properties>
        </channel>
    </channels>
</services>;

没错,但应用程序不会向 gintautas.dev.company.com 发出请求

编辑 2:我安装了 Flash Builder 4 并尝试使用 3.5 和 4.0(在兼容模式下)编译器进行编译,但两者都有相同的问题 :(

【问题讨论】:

  • 这可能有帮助,也可能没有帮助(因为我们尽可能地避免服务配置,并且尽可能多地以编程方式做),但我知道我几年前遇到的问题有与 AMFChannel 类与 SecureAMFChannel 类有关。我不确定在解析 services-config xml 文件时如何初始化 remoteObject 的 channelSet,但我知道当这些事情以编程方式完成时,我感觉好像我有更多的控制权。

标签: apache-flex flex3


【解决方案1】:

您可以尝试清除浏览器缓存吗? services.xml 的内容在编译时被注入到 SWF 中。

【讨论】:

  • 已经试过了。 Firefox中的Web Developer插件完全禁用缓存,每次下载所有文件/
  • 突然间它开始工作了,可能是因为我复制了项目并更改了工作区。
  • 不敢相信缓存问题再次袭击了我!感谢提及
【解决方案2】:

您可以使用以下命令从 *-config.XML 文件中检查正在编译成 flex 的内容:

trace( ServerConfig.XML );

另外,如果将 WTP 与 tomcat 一起使用,请检查服务器是否使用实际安装的 tomcat 或临时 eclipse 文件夹来运行。这有时会导致混淆。

【讨论】:

  • 大卫,感谢您的提示。与原始帖子有类似的麻烦 - 能够看到表面上已编译的内容是一件非常好的事情。 +1
【解决方案3】:

当您更改 services-config.xml 时,您必须在 Flex Builder 中“清理项目”

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-01-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-12
    • 1970-01-01
    相关资源
    最近更新 更多