0

I am struggling with getting a Flex SWF (which is embedded in JSP) to access remote data (from another domain).

I have a crossdomain.xml (which is embedded in my SWF). Its content is as follows:

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

In my main.xml I load the crossdomain.xml file using:

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

When I access the JSP webpage via the browser, the embedded SWF tries to do a Java remoting call and I get the following error:

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: 

I am pretty sure that the crossdomain.xml file actually get loaded by the SWF as I have created a simple URLLoader to load the xml file and check that there is no error. So I dont think that is an issue...

When I run the SWF in debug mode...I also see the following error message:

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.

Any help would be greatly appreaciated....

Mark

Michael
  • 87
  • 4
  • 14

1 Answers1

3

You need a master policy file at http://www.mysite.com:8380/crossdomain.xml with the following contents:

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

That will permit crossdomain policy files in subdirectories to be used.

James Ward
  • 29,283
  • 9
  • 49
  • 85
  • Thanks James, what is the master policy file called? and how does the SWF load it? – Michael Mar 14 '11 at 13:56
  • The master policy file in your case is: http://www.mysite.com:8380/crossdomain.xml It will be loaded automatically by Flash Player. – James Ward Mar 14 '11 at 14:00