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.
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.
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
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.
VuGen generates Custom Request functions containing unparsed AMF3 binary data.