簡體   English   中英

Django + pyamf:從動作腳本應用程序調用網關時出現奇怪的異常

[英]Django + pyamf: Strange exception when calling the gateway from actionscript application

能否請你幫忙。 我正在使用django-amf-gateway應用程序( http://bitbucket.org/wolever/django-amf-gateway )。

我以這種方式定義了網關:

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]

mx:RemoteObject方法名稱錯誤或需要更新Python代碼:

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

注意從“狀態”到“更新”的更改。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM