Flex 移动 + BlazeDS:生产者/RemoteObject (HTTP 502)
我最近从 Adobe 下载了最新版本的 BlazeDS Turnkey,看看是否可以让 BlazeDS 连接到我最近在 Flex 中制作的移动应用程序。在完成一两个教程后,我制作了一个基于浏览器的 Flex 应用程序,它基本上完成了我希望移动应用程序完成的所有操作。
然而,当我尝试让它在移动应用程序中工作时,我遇到了一些不同的错误,特别是 RemoteObject、Producer 对象。每当我尝试访问远程对象的 getServers() 方法(应用程序监视多个服务器的状态)时,我都会收到 HTTP 502 错误。每当我尝试使用生产者发送消息时,都会发生同样的事情。错误是:
Channel Fault: error; NetConnection.Call.Failed: HTTP: Status 502: url: 'http://erviceStatusUpdater.swf/samples/messagebroker/amfpolling'
“ServiceStatusUpdater”是应用程序的名称,它解释了第一部分,但不是“http://”声明后缺少的字母。我是否需要为每个生产者和远程对象声明一个端点?如果是这样,它们应该是什么?我尝试查找它,但似乎很难找到有关此类事情的文档。
我还应该提到“samples”是当前的上下文根,或者至少是使用同一服务器运行的其他项目中的根。消息传递通道和远程通道已经设置,因为它们与使用浏览器应用程序时相同。
谢谢
编辑:我已经设法通过指定远程对象的端点来使远程对象正常工作。对于遇到类似问题的任何人,终点(在我的例子中)是“http://localhost:8400/{context root}/messagebroker/amf”,其中“{context root}”是您的上下文根(在我的案例是“样本”)。但消费者仍然没有收到消息。
I recently downloaded the latest version of BlazeDS turnkey from Adobe to see if I could get BlazeDS to connect to a mobile app I'd recently made in Flex. After doing one or two tutorials, I made a browser-based flex app which basically did everything I wanted the mobile app to do.
However, when I tried to get it to work in the mobile app, I get a few different errors, specifically with the RemoteObject, Producer objects. Whenever I try to access the remote object's getServers() method (the app monitors the status of a number of servers), I get a HTTP 502 error. The same thing happens whenever I try to send a message using the Producer. The error is:
Channel Fault: error; NetConnection.Call.Failed: HTTP: Status 502: url: 'http://erviceStatusUpdater.swf/samples/messagebroker/amfpolling'
"ServiceStatusUpdater" is the name of the app, which explains the first part, but not the missing letter after the "http://" declaration. Do I need to declare an endpoint for each of the producers and remote objects? And if so, what should they be? I've tried looking it up but it seems to be quite difficult to find documentation on this sort of thing.
I should also mention that "samples" is the current context root, or at least that's what it was in the other project that ran using the same server. The messaging channel as well as the remoting channel have already been setup, as these are the same as when using the browser app.
Thanks
EDIT: I've managed to get the remote object to work by specifying the end point for the remote object. For anyone who's having a similar problem, the end point (in my case) was "http://localhost:8400/{context root}/messagebroker/amf", where "{context root}" is your context root (which in my case was "samples"). The consumer still isn't receiving messages, though.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
终于解决了这两个问题。 RemoteObject 的问题是端点未定义。此修复在我的问题的编辑中有详细说明。
消费者面临的第二个问题是没有为其定义渠道。为了做到这一点,必须定义消费者应该使用的通道集(可以是 ChannelSet 的实例),然后在该通道集中,应该有一个通道实例,其 URI 设置为指向正确的流(在我的例子中恰好与远程处理端点相同;amf)。
我在 actionscript 中进行了第二次修复,不确定是否可以在 mxml 中完成这一切。
Finally fixed both issues. The issue with the RemoteObject was that the endpoint was not defined. This fix is detailed in the edit to my question.
The second issue with the consumer was to do with the fact that no channels had been defined for it. In order to do this, one has to define the channel set that the consumer should use (which can be an instance of ChannelSet), and then within that channel set, there should be a channel instance which has its URI set to point to the correct stream (which in my case happened to be the same as the remoting endpoint; amf).
I made the second fix in actionscript, not sure if it's possible to do it all in mxml.