Google Web Toolkit - Data Format Extension (GWT-DFE)

The Google Web Toolkit (GWT) is a set of tools that allow web developers to create complex JavaScript front-end applications. The code is developed in Java and is open source. GWT supports, among other features: asynchronous remote procedure calls, history management, bookmarking, UI abstraction, internationalization, and cross-browser portability.

Applies to:

  • Web - HTTP/HTML Vuser scripts

  • Web - HTTP/HTML steps inside Flex Vuser scripts

Overview

The GWT-DFE support helps to generate Vuser scripts for GWT-based web sites that use the GWT-RPC mechanism. When you record a GWT-RPC based web site without enabling the GWT-DFE support, the resulting Vuser script may contain significant amounts of data that is cryptic and therefore difficult to decipher, as shown in the code segment below:

The cryptic formatting of the data makes it difficult to identify text strings to be used for correlation, parameterization, and verification.

Tip: The presence of numerous pipes in the recorded data indicates that the recorded site may be a GWT-based web site that uses the GWT-RPC mechanism.

When you enable GWT-DFE support, VuGen is able to decode much of the complex data in the HTTP responses and requests. This enables VuGen to generate Vuser scripts that contain data in XML format. In addition, the original coded data contains only values, without the associated names of the data fields. After applying GWT-DFE, the resulting XML-formatted data includes both the names and the values of the data fields. The XML-formatted data in the scripts is therefore easier to decipher, making the scripts easier to correlate, parameterize, and use for verification purposes.

To enable VuGen to decode the complex data in the HTTP communication, you must identify the .war file that is used by the web application. Occasionally, an application uses .jar files. All considerations below about .war files apply equally to .jar files when used instead of a .war file.

The .war file contains the logic used by GWT to encode and decode the information in the HTTP communication. VuGen needs access to the .war file so that VuGen can perform similar encoding and decoding procedures. Typically, these .war files are located on the application server, under the web applications folder.

Note: Make sure that the .war file that you associate with the Vuser script is the most up-to-date .war file for your application. The .war file is changed each time changes are made to the web application. GWT-DFE support will function correctly only if the most up-to-date .war file is available.

Note:  

  • GWT-DFE provides an automatic solution for GWT specific (STRONG_NAME_HEADER) correlations.
  • VuGen is able to parse Client Fields with GWT-DFE.

Back to top

Example of code generated with and without GWT-DFE support

Original Script - without GWT-DFE Support
6|0|11|http://localhost:8081/MyTestApp/testapp/|624C899BB846618A2E7F49092
8212946|com.test.client.GreetingService|greetServeCompAns|com.test.client.ComplexObject/198661839
|GWT User|inside object|java.util.HashSet/1594477813|java.lang.String/2004016611|add string1|
 string2|1|2|3|4|1|5|5|1001|1999|6|5|321|1234|7|0|8|0|8|2|9|10|9|11|

Script after applying GWT-DFE Support
<HP_EXTENSION name="GWT_DFE_1">
<com.hp.dfe.GWT__Request>
<moduleBaseURL>http://localhost:8081/MyTestApp/testapp/</moduleBaseURL>
<rpcRequest>
<flags>0</flags>
<method>
<class>com.test.client.GreetingService</class>
<name>greetServeCompAns</name>
<parameter-types>
<class>com.test.client.ComplexObject</class>
</parameter-types>
</method>
<parameters>
<com.test.client.ComplexObject>
<anIntField>1001</anIntField>
<anotherIntField>1999</anotherIntField>
<name>GWT User</name>
<objectInComposingField>
<anIntField>321</anIntField>
<anotherIntField>1234</anotherIntField>
<name>inside object</name>
<stringsSet/>
</objectInComposingField>
<stringsSet>
<string>add string2</string>
<string>add string1</string>
</stringsSet>
</com.test.client.ComplexObject>
</parameters>
<serializationPolicy class="com.google.gwt.user.server.rpc.impl.StandardSerializationPolicy"/>
</rpcRequest>
</com.hp.dfe.GWT__Request>
</HP_EXTENSION>

Back to top

Auto-detection of GWT Remote Procedure Calls (RPCs)

When VuGen generates or regenerates a Vuser script, VuGen scans the HTTP headers in the requests that are sent to the server. If VuGen detects both a x-gwt-module-base text string and a x-gwt-permutation text string in any of these HTTP headers, VuGen displays a warning in the VuGen Error tab. The warning recommends that you enable GWT-DFE for the Vuser script.

Note: VuGen will continue to issue the above warning - each time the script is generated or regenerated - until the GWT-DFE is enabled.

Back to top

How to apply a GWT Data Format Extension to your script before recording

To apply GWT-DFE before recording, perform the following actions:

  1. Open Recording Options (VuGen --> File --> Recording options)
  2. Go to the "Data Format Extension --> Chain Configuration” tab
  3. Add a new chain (press the green ‘+’ sign)

  4. In the dialog that opens, select GWT Extension and click OK.

  5. A new window will then open.
    To add the most recent WAR / JAR files, press the ‘+’ button and add them from the file system.

  6. Enable Data Format Extension

  7. Record or regenerate the GWT script.

After generating the script using GWT-DFE, you will get a readable LoadRunner API that includes the request inside an XML.

Back to top

Tips and troubleshooting

The exact same versions of the war and jar files that are on the server must be used by LoadRunner during code generation and replay.

If there are differences, LoadRunner gives an indication during Code Generation and Replay:

The follow errors can occur if the war and jar files do not match:

  • Class not found
  • Failed to handle WAR entry.
  • Failed to de-serialize method
  • Missing method
  • The correct GWT serialization policy could not be found.

To fix issues, ensure that:

  • The GWT DFE is enabled and the chains are configured correctly, including all .JAR, .CLASS and .GWT.RPC files used by the GWT application. After configuring the Chain, regenerate the script.
  • The Data Format Extension is enabled in runtime settings Data Format -> Chain Configuration -> Enable Data Format Extension.

Back to top

See also: