Tutorial Debug

From Plex-XML
Jump to: navigation, search

Tutorial workflow: Plex-XML tutorial main pagePreparing your environmentExtract the tutorial from CVSRestore the tutorial DBTutorial PlexTutorial EclipseTutorial application user guideTutorial debugTutorial LogHelp text Wiki

Debug your tutorial and investigate the generated XML

While your application runs in debug mode it will provide some XML and log files which can be very helpful if you are in doubt about the XML that is generated or in doubt about the performance of your application.

You can set the debug mode in your .localtomcat.properties file.

# Log level WARN, INFO, DEBUG

All debug files are written to the log and the temp directory of your Tomcat server.

As long as you haven't changed your normal Tomcat installation you will find two subdirectory in your Tomcat directory:

  • 'logs'
  • 'temp'

EmployeeUD request

Assuming you are haveing a problem in your 'Employee Update' function. You should login to your tutorial and click on the update function for one of your employee records. Stop working there with your tutorial, switch to your file explorer and have a look into the 'temp' directory of your Tomcat server. It may be helpful if you will sort your files descending by last change date now. You should find three XML files starting with EmployeeUD. These files are explained in the next section...

XML files generated by Plex-XML functions

Each Plex-XML web request generates 2-3 XML files during it's execution. If your application runs in debug mode these files are written into you file system. In normal mode these files are kept in memory only. This is to avoids performance drawbacks.

Request XML

Take a look on the EmployeeUD.xml. This file shows all the parameter mappings that are defined for your web request. You can also see all the parameter settings that are inherited by the 'extends' attribute and parameters that are added from the <default-parameter> section.

This XML file is very helpful if you are in doubt about the parameter values that are passed from a web request to your Plex-XML function. If a value is not passed to your function a common error is a misspelled parameter in the request URL.

<?xml version="1.0" encoding="UTF-8"?>
 <request asynchron="false" name="EmployeeUD" sequence="1">
  <plex-parameter format="" name="ControlInput_RequestID" value="3"/>
  <plex-parameter format="" name="Action_Action" value="P"/>
  <plex-parameter format="" name="UpdateKey_EmployeeID" value="4710"/>
  <plex-parameter name="ControlInput_SessionID" value="5288"/>
  <plex-parameter name="ControlInput_SECIPAddress" value=""/>
  <parameter name="locale" value="en"/>
  <parameter name="DateFormat" value="dd.MM.yyyy"/>

Response XML

Take a look on the EmployeeUD-response.xml. This file contains the XML that is generated from your Plex-XML function. Somewhere in the middle of the example below you should find the name 'Günter Last' because that is the name of the employee that should be changed. Together with these values you can find a lot of configuration and display attributes:

  • 'length' for the field length
  • 'lable' for the field label
  • 'DateFormat'

<?xml version="1.0" encoding="UTF-8"?>
  <response request-name="EmployeeUD" sequence="1">
    <parameter name="locale" value="en"/>
    <parameter name="DateFormat" value="dd.MM.yyyy"/>
          <group column="1">
              <returnvalue column="1" implname="EmpID" itype="readonly" label="ID" length="10"
               mandantory="true" maxl="10" name="EmpID" shape="Character" unformatted="4710" value="4710"/>
              <returnvalue column="1" implname="EmpName" itype="input" label="Employee Name" length="20" 
               mandantory="true" maxl="20" name="EmpName" shape="Character" unformatted="Günter Last" 
               value="Günter Last"/>
              <returnvalue column="1" implname="EmpHireStatus" itype="input" label="Hire Status" length="1"
               mandantory="true" maxl="1" name="EmpHireStatus" shape="Combo" unformatted="3" value="3">
                <selectvalue name=" " selected="false" value=" "/>
                <selectvalue name="Contract" selected="false" value="1"/>
                <selectvalue name="Part-time" selected="false" value="2"/>
                <selectvalue name="Full-time" selected="true" value="3"/>
              <returnvalue column="1" implname="EmpEmail" itype="input" label="E-Mail" length="50" 
               mandantory="true" maxl="50" name="EmpEmail" shape="Character" unformatted="last@allabout.de"

Filtered response XML

Take a look on the EmployeeUD-doc.xml. Unless you are setting the 'usedefaultstyle' attribute in the reaction of a web request to "false" each XML response is transformed two times by XSL. The result of the first transformation in our example is the EmployeeUD-doc.xml below and the result of the second transformation is the HTML that is transformed from this EmployeeUD-doc.xml and sent to your browser.

The main reason for this two step transformation is the ambition to get a consistent intermediate level of XML before the last transformation. This last transformation will transform the XML to HTML or PDF or maybe XML again if you like to exchange data between two applications.

Again you should be able to find 'Günter Last' and some configuration and control attributes in the example below.

      <button text="Cancel" alt="Cancel" image="close.gif" id="closeButton">
      <form method="post" name="EmployeeUD" disabled="false">
        <field name="Action" type="hidden">U</field>
        <field name="style" type="hidden"></field>
        <field id="rid" name="rid" type="hidden">3</field>
        <field name="ControlInput_frmFormat" type="hidden">DEFAULT</field>
        <field name="EmployeeID" type="hidden">4710</field>
        <group label="">
            <ffield id="EmpID" column="1" label="ID" mandantory="true">
              <field name="webFieldID" type="hidden" hid="fN65554">EmpID</field>
              <field name="webValue" impl="EmpID" type="readonly" label="ID" length="10"
               mandantory="true" maxl="10" shape="Character" hid="vN65554">4710</field>
            <ffield id="EmpName" column="1" label="Employee Name" mandantory="true">
              <field name="webFieldID" type="hidden" hid="fN65567">EmpName</field>
              <field name="webValue" impl="EmpName" type="input" label="Employee Name" length="20" 
               mandantory="true" maxl="20" shape="Character" hid="vN65567">Günter Last</field>


You will not find the HTML that is send to your browser in the Tomcat directory because it is much easier to debug HTML directly in your browser. There are some very powerful, free available tools like 'FireBug' or the 'IE Developer Toolbar'. See our Preparing your environment section for more info.


Analyze the execution and performance log...

Personal tools