2011-03-14 151 views
0

我很努力得到一个Flex SWF(它嵌入在JSP中)来访问远程数据(来自另一个域)。Flex CrossDomain.xml错误 - Channel.Security.Error错误错误#2048

我有一个crossdomain.xml(它嵌入在我的SWF中)。其内容如下:

Security.loadPolicyFile("http://www.mysite.com:8380/CSS/ReviewItemsServer/crossdomain.xml"); 

当我通过浏览器访问网页JSP,嵌入式SWF试图做的事:

<?xml version="1.0" encoding="UTF-8"?> 
<cross-domain-policy> 
    <site-control permitted-cross-domain-policies="all" /> 
    <allow-access-from domain="*"/> 
    <allow-http-request-headers-from domain="*" headers="*"/> 
</cross-domain-policy> 

在我main.xml中使用我加载crossdomain.xml文件一个Java远程调用,我得到以下错误:

Error string = Send failed 
Error code = Client.Error.MessageSend 
Error details = Channel.Security.Error error Error #2048: 
Security sandbox violation: http://www.mysite.com/CSS/ReviewItemsServer/ReviewItemsMain.swf 
cannot load data from http://www.mysite.com:8380/CSS/ReviewItemsServer/messagebroker/amf. url: 

我敢肯定的是,crossdomain.xml文件实际上得到由SWF加载,我创建了一个简单的URLLoader加载XML文件和CHEC k表示没有错误。所以,我不认为这是一个问题......

当我运行在调试模式下的SWF ...我还看到了以下错误消息:

Error: [strict] Ignoring policy file at http://www.mysite.com:8380/CSS/ReviewItemsServer/crossdomain.xml due to missing Content-Type. See http://www.adobe.com/go/strict_policy_files to fix this problem. 

任何帮助将大大appreaciated ... 。

马克

回答

3

您需要在http://www.mysite.com:8380/crossdomain.xml具有下列内容的主策略文件:

<?xml version="1.0" encoding="ISO-8859-1"?> 
<cross-domain-policy> 
    <site-control permitted-cross-domain-policies="all"/> 
</cross-domain-policy> 

这将允许使用子目录中的跨域策略文件。

+0

谢谢James,主策略文件叫什么名字?以及SWF如何加载它? – Michael 2011-03-14 13:56:10

+0

您的案例中的主策略文件是:http://www.mysite.com:8380/crossdomain.xml它将由Flash Player自动加载。 – 2011-03-14 14:00:58