views:

484

answers:

2

I'm trying to use BlazeDS's AMFConnection class to connect to pyamf, but when I call AMFConnection.call(), I get HTTP status 400 (Bad Request - "The request body was unable to be successfully decoded."). I'm more or less following this example: (pyamf.org/wiki/ClientHowTo ... sorry, I'm a new user so I guess I can't use hyperlinks. append a "http://" to those if you want to follow them)

Here's my code:

package amfconnectiontest;
import flex.messaging.io.amf.client.AMFConnection;
import flex.messaging.io.amf.client.exceptions.*;

public class Main {

public static void main(String[] args) {
    AMFConnection amfConnection = new AMFConnection();

    String url = "http://demo.pyamf.org/gateway/recordset";
    String service = "service.getLanguages";
    try
    {
       amfConnection.connect(url);
    }
    catch (ClientStatusException cse)
    {
       System.out.println(cse);
       return;
    }
    // Make a remoting call and retrieve the result.
    try
    {
       Object result = amfConnection.call(service);
       System.out.println("results: " + result.toString());
    }
    catch (ClientStatusException cse)
    {
       System.out.println(cse);
    }
    catch (ServerStatusException sse)
    {
       System.out.println(sse);
    }

    // Close the connection.
    amfConnection.close();
}
}

Any ideas?

A: 

The ability to en/decode BlazeDS specific messages (implementing ISmallMessage) has landed on the PyAMF trunk (r2726 and up). See the related ticket - http://pyamf.org/ticket/581

This version or one very similar is likely to become 0.5. If you need to connect to a BlazeDS service I would suggest checking out the trunk.

njoyce
A: 

Hello,

I took latest revision from SVN trunk, but still I am getting 400 BAD request. Any idea? The class is fine because i am able to call from ActionScript.