Debugging Custom Code

Debug the Mobile Workflow package html and js 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 level of the Mobile Workflow tracing to Debug:
    1. Open <UnwiredPlatform_InstallDir>\UnwiredPlatform-XX\Servers\MessagingServer\Data\TraceConfig.xml with a text editor.
    2. In the WorkflowClient module section, change the tracing level to Debug, as shown:
      <Module
            Name="WorkflowClient"
            Level="Debug"
            Desc="Workflow client" />
  2. Open the browser to use for debugging and open the Java Console.
    If you are using Chrome:
    1. Add the following command line option to the shortcut used to start Chrome:
      ..\chrome.exe" --allow-file-access-from-files
  3. You can debug a client-initiated Mobile Workflow application up until the point where a menu item of the Submit Workflow type is performed. If the menu item action is an Online Request, place the XMLWidgetMessage (available in the WorkflowClient trace log located in <UnwiredPlatform_InstallDir>\UnwiredPlatform\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 workflow.html file.
  4. From WorkSpace Navigator, drag and drop the workflow.html file for the Mobile Workflow application to debug onto the browser window.
  5. Find the name of the screen to debug:
    1. In Flow Design, click the screen to debug.
    2. In the Properties view, click General in the left pane.
      The screen name is shown in Name, 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/MobileWorkflow101/Generated%20Workflow/travelrequest/html/workflow.html?screenToShow=TravelRequest_create
  7. To simulate an e-mail message triggered Mobile Workflow application:
    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 Mobile Workflow application you are debugging, place the transform.xml file at the same level as the generated workflow.html file (Generated Workflow\<Workflow_application_name>\html).
    3. Add a ?loadtransformdata=true parameter to load the data into the Workflow application.
  8. Set up client tracing for the device user in Sybase Control Center. This is the location where the messages from the method logToWorkflow are written.
    1. In Sybase Control Center, set the device debug trace level to 4 (debug).
      See Sybase Control Center for Unwired Platform documentation for information about setting the device trace level.
    2. Redeploy the Mobile Workflow package.
    3. In Sybase Control Center, select Get Trace after using the Mobile Workflow.
      The log file is written to <UnwiredPlatform_InstallDir>\logs\<machine_name-server.log>.
Related tasks
Testing Server Initiated Mobile Workflow Packages
Related reference
Launching a Server-initiated Mobile Workflow on the Device