SWF(使用 URLLoader)可以访问 HTTPS Web 服务吗?
我有一个 fla(使用 ActionScript 3.0),我正在 Flash 中进行编译。我正在使用 URLRequest 和 URLLoader 访问 http web 服务。
var loader:URLLoader = new URLLoader();
var request:URLRequest = new URLRequest("http:test.webservice.com");
try {
loader.load(request);
} catch (error:Error) {
trace("Unable to load requested document.");
}
这工作正常 - 但是如果我尝试访问 https 地址,我会得到
httpStatusHandler: [HTTPStatusEvent type="httpStatus" bubbles=false cancelable=false eventPhase=2 status=0]
ioErrorHandler: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: https://test.webservice.com"]
How can Iretrieve data from a https web service? SWF 是否必须托管在 SSL 安全页面上?
I have a fla (using ActionScript 3.0) I am compiling in Flash. I am using URLRequest and URLLoader to access a http webservice.
var loader:URLLoader = new URLLoader();
var request:URLRequest = new URLRequest("http:test.webservice.com");
try {
loader.load(request);
} catch (error:Error) {
trace("Unable to load requested document.");
}
This works fine - however if I try and access a https address I get
httpStatusHandler: [HTTPStatusEvent type="httpStatus" bubbles=false cancelable=false eventPhase=2 status=0]
ioErrorHandler: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: https://test.webservice.com"]
How can I retrieve data from a https web service? Does the SWF have to be hosted on a SSL secured page?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您安装了 Flash 调试播放器,您可能会在日志中看到以下内容:
默认情况下,http 中托管的 swf 无法访问 https — 它被视为不同的域。
您需要设置适当的 crossdomain.xml 策略文件,并小心验证 Content-Type 是 text/* 或其他列入白名单的值。此外,您还需要一个带有“secure=false”的元策略文件,该文件将允许从 http 访问 https。
进一步阅读:
Flash Player 9 和 Flash Player 10 中的策略文件更改
If you install the flash debug player, you'll probably see the following in the log:
By default a swf hosted in a http cannot access https --it's considered a different domain.
You'll need to set up the appropriate crossdomain.xml policy file, with care to verify the Content-Type is text/* or another whitelisted value. Additionally, you'll need a meta-policy file with "secure=false", which will allow https to be accessed from http.
Further reading:
Policy file changes in Flash Player 9 and Flash Player 10
检查actionscript文档中的跨域策略。
http://kb2.adobe.com/cps/142/tn_14213.html
Check the crossdomain policy in the actionscript documentation.
http://kb2.adobe.com/cps/142/tn_14213.html