小编igu*_*igu的帖子

在flex上设置JSON内容类型:在flex中设置HttpService

我试图在httpservice上设置json内容类型,以使REST服务返回json数据.当我在fiddler中添加内容类型时,所有工作正常,因此问题在flex应用程序中,而不是在Web服务中.但是下面的代码不起作用,我得到xml数据而不是json.

有人能为我提供解决方法/解决方案吗?

MXML:

<s:HTTPService id="service" method="POST" url="server.com" 
               result="loaded(event)" fault="fault(event)" 
               useProxy="false" resultFormat="text">
Run Code Online (Sandbox Code Playgroud)

动作:

public function loadAllSamples():void {
    service.contentType = "application/json";
    service.send('something');
}
Run Code Online (Sandbox Code Playgroud)

apache-flex json actionscript httpservice

7
推荐指数
2
解决办法
8889
查看次数

标签 统计

actionscript ×1

apache-flex ×1

httpservice ×1

json ×1