Recently, QualityLogic performed a load test on a Flash remoting application using SoapUI. Currently, SoapUI doesn’t have support for the AMF format used to communicate with the gateway. The first step is to add AMF related classes to SoapUI. I downloaded BlaseDS, Adobe’s Flash remoting platform. After extracting the package, the jar files from the resources\lib directory were copied into \bin\ext in the SoapUI install directory.

At this point, we tried modifying the code example in the above blog post:

import flex.messaging.io.amf.ASObject;
import flex.messaging.io.amf.client.AMFConnection;
def amfConnection = new AMFConnection();
amfConnection.instantiateTypes = false
try
{
amfConnection.connect(  "http://my-flash-remoting-gateway/" );
def result = amfConnection.call( "some-method", …  )
return result.toString()
}
finally
{
amfConnection.close()
}

We didn’t have any Java classes to match the objects that would be retrieved, so we removed the call to registerAlias from the original sample code. This worked great on one server, but not on another. It turns out the rubyamf gateway requires the content type to be specified whereas amfphp doesn’t. That problem was solved by adding a Content-type header to the AMF connection:

amfConnection.addHttpRequestHeader("Content-type", "application/x-amf");

AmfConnection.Call returns an ASObject containing the AMF response. ASObject is derived from Java’s HashMap, so it is a simple matter to extract returned data. The tricky part here is knowing what data the server expects. ServiceCapture was a great deal of help here.