Debugging Custom Code

Debug the Hybrid App package HTML and JavaScript files using a Windows desktop browser.

This procedure uses Google Chrome as an example, but you can use any browser that supports JavaScript debugging.

  1. Change the tracing level of Hybrid App to Debug.
  2. Open the browser to use for debugging and open the Java Console.
    If you are using Chrome:
    1. Add this command line option to the shortcut used to start Chrome:
      ..\chrome.exe" --allow-file-access-from-files
  3. You can debug a client-initiated Hybrid App up until the point where a menu item of the Submit type is performed. If the menu item action is an Online Request, place the XMLWidgetMessage (available in the WorkflowClient trace log located in SMP_HOME\Servers\UnwiredServer\logs\WorkflowClient) that is the expected response message into an rmi.xml file and place it at the same level as the generated hybridapp.html file.
    Note: Control characters are not parsed correctly when using rmi.xml and Chrome to debug the Hybrid App. Do not format the content of the rmi.xml when debugging the Hybrid App using Chrome. If you want a formatted look at the rmi.xml file, make a copy of the file for that purpose.
  4. From WorkSpace Navigator, drag and drop the hybridapp.html file for the Hybrid App to debug onto the browser window.
  5. Find the name of the key to debug:
    1. In Flow Design, click the screen to debug.
    2. In the Properties view, click General in the left pane.
      The key name is shown, in this example, that is TravelRequest_create.
      mwf_debug_screen_name
  6. In the URL, add the ?screenToShow=<Screen_name> parameter to the end of the URL, for example:
    file:///C:/Documents%20and%20Settings/<user_name>/workspace/HybridApp101/Generated%20HybridApp/travelrequest/html/hybridapp.html?screenToShow=TravelRequest_create
  7. To simulate an e-mail message triggered Hybrid App:
    1. Create a file called transform.xml and place the contents of the XMLWidgetMessage into it.
      The contents of the XMLWidgetMessage are in the WorkflowClient trace log in <UnwiredPlatform_InstallDir>\UnwiredPlatform\Servers\UnwiredServer\logs\WorkflowClient).
    2. To provide data to the Hybrid App you are debugging, place the transform.xml file at the same level as the generated hybridapp.html file (Generated Hybrid App\<Hybrid_App_name>\html).
    3. Add a ?loadtransformdata=true parameter to load the data into the Hybrid App.
Related tasks
Testing Server-Initiated Hybrid App Packages
Related reference
Launching a Server-initiated Hybrid App on the Device