I am new to both flex and web2py and I am having great difficulty
trying to allow flex to simple connect to web2py. I have followed a
few threads here and also copied line for line from this tutorial:
http://www.web2pyslices.com/main/slices/take_slice/72 and still no
solution. I have web2py set up on my windows 7 box and I am using
flash builder 4 to set up my flex. Currently i have:

FLEX:
---------------------
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute">
        <mx:Script>
                <![CDATA[
                        import mx.rpc.events.FaultEvent;
                        import mx.rpc.events.ResultEvent;
                        import mx.controls.Alert;

                        private function resultHandler(event:ResultEvent):void
                        {
                                Alert.show(event.result.toString());
                        }

                        private function faultHandler(event:FaultEvent):void
                        {
                                Alert.show(event.fault.message);
                        }
                ]]>
        </mx:Script>

        <mx:RemoteObject
                id="amfService"
                endpoint="http://127.0.0.1:8000/myapp/rpc/call/amfrpc3";
                destination="mydomain"
                showBusyCursor="true">
                <mx:method name="test" result="resultHandler(event)"
fault="faultHandler(event)"/>
        </mx:RemoteObject>
        <mx:Button x="250" y="150" label="Fire" click="amfService.test();"/>
</mx:Application>

rpc.py
----------------------------------------
from gluon.tools import Service
service = Service(globals())

def call():
    session.forget()
    return service()

@service.amfrpc3("mydomain")
def test():
    return "Test!!!"

Flex Error:
-------------------------------------
faultCode:Client.Error.MessageSend
faultString:'Send failed'
faultDetail:'Channel.Connect.Failed error NetConnection.Call.Failed:
HTTP: Status 400: url: 'http://127.0.0.1:8000/myapp/rpc/call/amfrpc3''


Can anyone explain why I cannot connect with flex. Am I not setting
something up that I should be. Any help would be greatly appreciated.

Reply via email to