Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing mx:RemoteObject with web2py's @service.amfrpc decorator
    primarykey
    data
    text
    <p>I am using web2py (v1.63) and Flex 3. web2py v1.61 introduced the @service decorators, which allow you to tag a controller function with @service.amfrpc. You can then call that function remotely using <code>http://..../app/default/call/amfrpc/[function]</code>. See <a href="http://www.web2py.com/examples/default/tools#services" rel="nofollow noreferrer">http://www.web2py.com/examples/default/tools#services</a>. Does anybody have an example of how you would set up a Flex 3 to call a function like this? Here is what I have tried so far:</p> <pre><code>&lt;mx:RemoteObject id="myRemote" destination="amfrpc" source="amfrpc" endpoint="http://{mysite}/{myapp}/default/call/amfrpc/"&gt; &lt;mx:method name="getContacts" result="show_results(event)" fault="on_fault(event)" /&gt; &lt;/mx:RemoteObject&gt; </code></pre> <p>In my scenario, what should be the value of the destination and source attributes? I have read a couple of articles on non-web2py implementations, such as <a href="http://corlan.org/2008/10/10/flex-and-php-remoting-with-amfphp/" rel="nofollow noreferrer">http://corlan.org/2008/10/10/flex-and-php-remoting-with-amfphp/</a>, but they use a .../gateway.php file instead of having a URI that maps directly to the function.</p> <p>Alternatively, I have been able to use flash.net.NetConnection to successfully call my remote function, but most of the documentation I have found considers this to be the old, pre-Flex 3 way of doing AMF. See <a href="http://pyamf.org/wiki/HelloWorld/Flex" rel="nofollow noreferrer">http://pyamf.org/wiki/HelloWorld/Flex</a>. Here is the NetConnection code:</p> <pre><code>gateway = new NetConnection(); gateway.connect("http://{mysite}/{myapp}/default/call/amfrpc/"); resp = new Responder(show_results, on_fault); gateway.call("getContacts", resp); </code></pre> <p>-Rob</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload