Flash Builder 4 Security error accessing url Destination: DefaultHTTP
I have built a FB4 application which accesses a .NET web service of a partner company. The app runs just fine in FB4 development environment, but won't work when published to my server. I can not figure out how to get past the following error:
Security error accessing url Destination: Default开发者_Go百科HTTP
It is unlikely that I will get a crossdomain.xml file on their server, so I'm trying to get it to work using a proxy. The proxy.php is located in the same directory as the swf, and it works just fine if I use it directly in the browser.
The following is what I currently have setup:
proxy.php:
<?php
$session = curl_init(trim(urldecode($_GET['url']))); // Open the Curl session
curl_setopt($session, CURLOPT_HEADER, false); // Don't return HTTP headers
curl_setopt($session, CURLOPT_RETURNTRANSFER, true); // Do return the contents of the call
$xml = curl_exec($session); // Make the call
header("Content-Type: text/xml"); // Set the content type appropriately
echo $xml; // Spit out the xml
curl_close($session); ?>
The code in Flash Builder 4 (I'm using a Webservice object in FB4):
wsdl = http://example.com/autoben/proxy2.php?url=http://staging.partnerCompany.net/api/v01_00/theservice.asmx?wsdl
The flash player is version 10.x
I'm obviously not understanding the new security rules built into the latest Flash player.
A screenshot of the error can be seen here:
Sounds like a cross domain policy issue. Check here http://livedocs.adobe.com/flex/3/html/help.html?content=security2_04.html for Adobe's advice.
I can't see any obvious reason to why this should not work in concept. So it's likely some minor detail tripping this up.
I would recommend using a web debug proxy to work out exactly what is going across the pipes, I personally prefer Charles but something like Fiddler should work too.
Make sure you're using relative paths to get the url and not absolute, if you go to http://mydomain.com and it tries to get the proxy url from http://www.mydomain.com (www. subdomain) a security error will be thrown.
精彩评论