姜戈 + pyamf:从 ActionScript 应用程序调用网关时出现奇怪的异常

发布于 2024-08-09 18:49:11 字数 3182 浏览 3 评论 0原文

你能帮忙吗? 我正在使用 django-amf-gateway 应用程序 (http://bitbucket.org/wolever/django -amf-网关)。

我这样定义网关:

from django_amf_gateway import register_amf_service
from goserver.models import Game

class ChangeService(object):
    def state(self):
        game = Game.objects.get(id = 1)
        return game.move_number


register_amf_service('state', ChangeService, [Game])

当我这样从 mxml 调用服务时:

updateService.state();

<mx:RemoteObject id="updateService" endpoint="{Config.updateGateWay}" destination="state">
    <mx:method name="update" result="onSuccess(event)" fault="onFault(event)" />
</mx:RemoteObject>

我得到一个异常:

> [RPC Fault
> faultString="[MessagingError
> message='Destination 'state' either
> does not exist or the destination has
> no channels defined (and the
> application does not define any
> default channels.)']"
> faultCode="InvokeFailed"
> faultDetail="Couldn't establish a
> connection to 'state'"]   at
> mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::invoke()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:263]
>   at
> mx.rpc.remoting.mxml::Operation/http://www.adobe.com/2006/flex/mx/internal::invoke()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\remoting\mxml\Operation.as:197]
>   at
> mx.rpc.remoting::Operation/send()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\remoting\Operation.as:113]
>   at
> Function/http://adobe.com/AS3/2006/builtin::apply()
>   at
> mx.rpc.remoting.mxml::Operation/send()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\remoting\mxml\Operation.as:170]
>   at
> Function/http://adobe.com/AS3/2006/builtin::apply()
>   at
> mx.rpc::AbstractService/http://www.adobe.com/2006/actionscript/flash/proxy::callProperty()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AbstractService.as:290]
>   at
> Game/main()[/Users/oleg/jin/goclub/trunk/goapp/usersList/src/Game.mxml:51]
>   at
> Game/___Game_Application1_creationComplete()[/Users/oleg/jin/goclub/trunk/goapp/usersList/src/Game.mxml:3]
>   at
> flash.events::EventDispatcher/dispatchEventFunction()
>   at
> flash.events::EventDispatcher/dispatchEvent()
>   at
> mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:9298]
>   at mx.core::UIComponent/set
> initialized()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:1169]
>   at
> mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:718]
>   at
> Function/http://adobe.com/AS3/2006/builtin::apply()
>   at
> mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8628]
>   at
> mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8568]

Could you please help.
I am using the django-amf-gateway application (http://bitbucket.org/wolever/django-amf-gateway).

I defined the gateway this way:

from django_amf_gateway import register_amf_service
from goserver.models import Game

class ChangeService(object):
    def state(self):
        game = Game.objects.get(id = 1)
        return game.move_number


register_amf_service('state', ChangeService, [Game])

And when I called the service from mxml this way:

updateService.state();

<mx:RemoteObject id="updateService" endpoint="{Config.updateGateWay}" destination="state">
    <mx:method name="update" result="onSuccess(event)" fault="onFault(event)" />
</mx:RemoteObject>

I got an exception:

> [RPC Fault
> faultString="[MessagingError
> message='Destination 'state' either
> does not exist or the destination has
> no channels defined (and the
> application does not define any
> default channels.)']"
> faultCode="InvokeFailed"
> faultDetail="Couldn't establish a
> connection to 'state'"]   at
> mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::invoke()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:263]
>   at
> mx.rpc.remoting.mxml::Operation/http://www.adobe.com/2006/flex/mx/internal::invoke()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\remoting\mxml\Operation.as:197]
>   at
> mx.rpc.remoting::Operation/send()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\remoting\Operation.as:113]
>   at
> Function/http://adobe.com/AS3/2006/builtin::apply()
>   at
> mx.rpc.remoting.mxml::Operation/send()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\remoting\mxml\Operation.as:170]
>   at
> Function/http://adobe.com/AS3/2006/builtin::apply()
>   at
> mx.rpc::AbstractService/http://www.adobe.com/2006/actionscript/flash/proxy::callProperty()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AbstractService.as:290]
>   at
> Game/main()[/Users/oleg/jin/goclub/trunk/goapp/usersList/src/Game.mxml:51]
>   at
> Game/___Game_Application1_creationComplete()[/Users/oleg/jin/goclub/trunk/goapp/usersList/src/Game.mxml:3]
>   at
> flash.events::EventDispatcher/dispatchEventFunction()
>   at
> flash.events::EventDispatcher/dispatchEvent()
>   at
> mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:9298]
>   at mx.core::UIComponent/set
> initialized()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:1169]
>   at
> mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:718]
>   at
> Function/http://adobe.com/AS3/2006/builtin::apply()
>   at
> mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8628]
>   at
> mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8568]

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

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

发布评论

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

评论(1

燕归巢 2024-08-16 18:49:11

mx:RemoteObject 方法名称错误或需要更新 Python 代码:

class ChangeService(object):
    def update(self):
        game = Game.objects.get(id = 1)
        return game.move_number

请注意从“state”到“update”的更改。

Either the mx:RemoteObject method name is wrong or the Python code needs to be updated:

class ChangeService(object):
    def update(self):
        game = Game.objects.get(id = 1)
        return game.move_number

Note the change from 'state' to 'update'.

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