如何访问闪存内的外部数据?

时间:2013-03-06 03:59:53

标签: java web-services flash crossdomain.xml

我是flash的新手,我有一个flash(.swf)文件,通过WSDL方法显示我的数据库内容。当它被加载时,我可以看到我的数据,但它在内部尝试自己刷新flash对象时显示一些错误。

我使用eclipse进行开发,将Tomcat 7用作webserver。

我已将crossdomain.xml放在/ Root文件夹中,我可以通过点击

通过网络浏览器显示crossdomain.xml内容
"http://localhost:8080/crossdomain.xml"

(Note : 1. Both web service and flash file are running in the same server.
        2. This error occurs only before accessing any data from server, once data is accessed the error is not generating anymore)

当flash文件尝试刷新自身时,它会显示以下错误。

- >

To access external data, add a cross-domain policy file to the external data web server.



For more information, on the Adobe website, see the article "Cross-domain Policy File Specification".



If the problem persists, contact the file creator or your system administrator.


Error: Error #2032

Connection Type: Web Service

File URL: http://localhost:8080/StudentService/performance.swf

External Data URL: http://localhost:8080/StudentService/services/StudentService

1 个答案:

答案 0 :(得分:0)

尝试添加to-port属性和allow-http-request-headers-from元素,如...

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM
"http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">

<cross-domain-policy>
    <site-control permitted-cross-domain-policies="master-only"/>
    <allow-access-from domain="*" to-ports="*" secure="false"/>
    <allow-http-request-headers-from domain="*" headers="SOAPAction"/>
</cross-domain-policy>

感谢。

@Leo。