首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >使用AS3调用REST服务时发生流错误

使用AS3调用REST服务时发生流错误
EN

Stack Overflow用户
提问于 2016-01-06 12:16:03
回答 1查看 250关注 0票数 0

我正在尝试使用AS3做一个REST客户端,下面是本教程:US/as3/dev/WSb2ba3b1aad8a27b061afd5d7127074bbf44-8000.html

我的代码如下:

代码语言:javascript
运行
复制
import flash.events.Event; 
import flash.events.ErrorEvent; 
import flash.events.IOErrorEvent; 
import flash.events.SecurityErrorEvent; 
import flash.net.URLLoader; 
import flash.net.URLRequest; 
import flash.net.URLRequestMethod; 
import flash.net.URLVariables;

var url:String = "https://localhost:8443/restcomponent/tesimalex";

var requestor:URLLoader = new URLLoader(); 

function restServiceCall():void 
{ 
    trace("Calling REST Service...");
    //Create the HTTP request object 
    var request:URLRequest = new URLRequest( url ); 
    request.method = URLRequestMethod.GET; 

    //Add the URL variables 
  //  var variables:URLVariables = new URLVariables(); 
  //  variables.method = "test.echo"; 
  //  variables.api_key = "123456ABC"; 
  //  variables.message = "Able was I, ere I saw Elba.";             
  //  request.data = variables; 

    //Initiate the transaction 
    requestor = new URLLoader(); 
    requestor.addEventListener( Event.COMPLETE, httpRequestComplete ); 
    requestor.addEventListener( IOErrorEvent.IO_ERROR, httpRequestError ); 
    requestor.addEventListener( SecurityErrorEvent.SECURITY_ERROR, httpRequestError ); 
    requestor.load( request ); 
} 

function httpRequestComplete( event:Event ):void 
{ 
    trace( event.target.data );     
} 

function httpRequestError( error:ErrorEvent ):void{ 
    trace( "An error occured: " + error.toString() );     
}

我的代码与本教程中的代码之间唯一的差异是我注释的URL变量和url使用的url变量。

REST服务是一个简单的GET,如果我在浏览器中键入url,它将显示返回的JSON。

但是在我的AS3中,当我调用restServiceCall()方法时,它返回以下错误:

打开URL 'https://localhost:8443/restcomponent/tesimalex?‘时出错发生了一个错误:[IOErrorEvent type="ioError“bubbles=false cancelable=false eventPhase=2 text=”错误#2032:流错误. URL:https://localhost:8443/restcomponent/tesimalex?"]

有人知道怎么回事吗?

EN

回答 1

Stack Overflow用户

发布于 2016-01-06 16:24:13

好的..。这是安全问题..。我在服务器上禁用了SSL,然后我的flash应用程序成功地与我的REST服务进行了连接。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34632954

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档