弹性网络服务

发布于 2024-12-11 13:40:40 字数 592 浏览 4 评论 0原文

我正在使用 Flash Builder 4.5 和 flex 4.5 语言。 我正在使用 Web 服务调用 .php 来检索 json 中的数据。

<webservice:Webservice id="webservice" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
<s:CallResponder id="testResult" result="onTestResult(event)"/>

...

private function onTestResult(e:ResultEvent):void{
    Alert.show(ObjectUtil.toString(testResult.lastResult));
}

在 Flash Builder 的“测试操作”窗口中,我进行了调用,返回的是一个由数组组成的 json 对象。

如果我从代码中调用相同的 Web 服务,它会返回 (object)#0,因此是一个空对象。没有错误抛出,只是一个空对象。

有人有一些建议吗?

I'm using Flash Builder 4.5 and flex 4.5 language.
I'm using a webservice to retrieve data in json calling a .php.

<webservice:Webservice id="webservice" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
<s:CallResponder id="testResult" result="onTestResult(event)"/>

...

private function onTestResult(e:ResultEvent):void{
    Alert.show(ObjectUtil.toString(testResult.lastResult));
}

In the "Test Operation" window of Flash Builder I made my call and the return is a json Object made by arrays.

If I call the same webservice from the code instead, it returns a (object)#0 so an empty Object. No errors thown, just an empty Object.

Anyone has some tips?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

和我恋爱吧 2024-12-18 13:40:40

Webservice 类的 ns 前缀表明您正在使用自定义实现,而不是框架 WebService 类。但是,您没有提供任何具体信息,因此我将在黑暗中采取行动:

如果您的自定义服务基于 HTTPService 类,请确保您设置 resultFormat='文本'。默认值为 XML,这会给您带来问题。

如果您使用的是 Framework WebService 类,那么您不能这样做,因为它是为 SOAP Web 服务而不是 JSON 设计的。 (来自 mx.rpc.soap.WebService 的文档:)

WebService 类提供对基于 SOAP 的 Web 服务的访问
远程服务器。

如果是其他实现,请提供更多详细信息。

The ns prefix of your Webservice class susggests you're using a custom implementation, rather than the framework WebService class. However, you don't provide any specifics, so I'm gonna take a swing in the dark:

If your custom service is based off the HTTPService class, make sure you're setting the resultFormat='text'. The default is XML, which will be causing you problems.

If you're using the Framework WebService class, well - you can't, as it's designed for SOAP webservices, not JSON. (From the Docs for mx.rpc.soap.WebService:)

The WebService class provides access to SOAP-based web services on
remote servers.

If it's some other implementation, please provide more details.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文