Close

January 3, 2014

AMF Protocol Overview in HP LoadRunner

AMF Protocol Overview - Client Server

In this blog post, we will learn about AMF Protocol, AMF Terms, sample script and recording mode of AMF Protocol in HP LoadRunner.

HTTP is the preferred method of communication between client and server. For the secure way of communication, SOAP (Simple Object Access Protocol) over HTTP, an XML based format is useful. But the limitation of SOAP over HTTP is: it cannot transfer large files such as Rich Internet Applications, Flash files etc.

Hence Macromedia created proprietary protocol called Action Message Format (AMF) protocol which communicates over HTTP in binary format. This binary AMF data is smaller than SOAP’s XML.

AMF Protocol Overview Client Server

AMF Protocol Overview Client Server

Client application (computer, mobiles, tablets etc) submits AMF messages over HTTP to the application server. Flash players from the client application sends native Flash objects to an application server via a gateway called Flash Remoting Gateway which is a server-side object (which is installed either in Java (ColdFusion) or in .NET).

This gateway acts as an intermediator that handles request between client and the server. It translates the objects and serves the appropriate services.

Once the requests processed, the gateway serializes back into native Flash objects and send them to the client application.

Action Script – a scripting programming language (similar to Javascript) is used to control Flash movies and application.

Below is the sample AMF script:

amf_define_header_set("Id=amf_header_set",

    HEADER,

    "Name=amf_server_debug",

    "MustUnderstand=true",

    "Data=<object><boolean key=\"coldfusion\">true</boolean>

                  <boolean key=\""    "amfheaders\">false</boolean>...

    LAST);

amf_call("flashgateway.samples.FlashJavaBean.testDocument",

    "Gateway=http://testlab:8200/flashservices/gateway",

    "AMFHeaderSetId=amf_header_set",

    "Snapshot=t3.inf",

    MESSAGE,

    "Method=flashgateway.samples.FlashJavaBean.testDocument",

    "TargetObjectId=/1",

    BEGIN_ARGUMENTS,

    "<xmlString><![CDATA[<TEST message=\"test\"><INSIDETEST

        /></TEST>]]></"

    "xmlString>",

    END_ARGUMENTS,

    LAST);

Recording Settings for AMF Protocol

You can use following protocol combinations to record:

  • AMF Only
  • Web Only
  • AMF and Web

AMF Protocol Overview Recording Options

AMF Protocol Overview Recording Options

Commons Issues you face in AMF protocol

When you record Flex applications using AMF protocol, sometimes VuGen might not be able to decode externalizable objects. To overcome this issue, go to Recording Options, click on Code Generation under AMF Protocol and check Encode externalizable object with LoadRunner parser as shown below and then click on OK.

AMF Protocol Overview AMF Code Generation

AMF Protocol Overview AMF Code Generation

VuGen generates Custom Request functions containing unparsed AMF3 binary data.

About NaveenKumar Namachivayam

Hi there! is a passionate and experienced Performance Test Analyst based in Chicago, USA with skill sets in Manual Testing, Test Automation, Performance Testing, and Test Estimation. He loves to learn and experiment new trends and models in Software Testing. Please stop by at his personal blogs: Excel Blog, DealsBrook, NaveenKumarN.in, and Affiliate Insights blog and Software Testing Memes.

Leave a Reply

Your email address will not be published. Required fields are marked *