Flex 忽略 services-config.xml 中的更改
昨天我花了半天时间试图强制 Flex Remoting 使用 HTTPS,但没有成功。
今天我尝试连接到其他域。 我更改了端点的 url,但看起来 Flex 只是忽略了我的更改。 我确信 src 目录中的任何文件中都不存在旧网址, 我什至将 services-config.xml 重命名为 services-config2.xml,多次清理和重建项目,甚至进行了发布版本,但它仍然连接到同一域。
我已经在本地主机和具有 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/ dir,发现 FlexInit 文件(如 MainModule_FlexInit-generate.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(兼容模式)编译器进行编译,但两者都有相同的问题:(
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"/>
<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>;
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 :(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以尝试清除浏览器缓存吗? services.xml 的内容在编译时注入到 SWF 中。
Can you try to clear your browser cache ? The content of the services.xml is injected into the SWF at compile time.
您可以使用以下命令检查从 *-config.XML 文件编译到 Flex 中的内容:
此外,如果将 WTP 与 tomcat 一起使用,请检查服务器是否正在使用实际安装的 tomcat 或临时 eclipse 文件夹来运行。这有时会导致混淆。
you can check what is being compiled into flex from the *-config.XML files with the following:
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.
更改 services-config.xml 时,必须在 Flex Builder 中“清理项目”
You must "clean project" in Flex Builder when you change services-config.xml