Skip to content
Rob van Oostenrijk edited this page May 15, 2014 · 1 revision

Introduction

The Debug engine wraps around the Tridion DebugSession and uses the same template rendering process as the standard Tridion Template Builder application.

However whereas the template builder executes the template remotely using the CompoundTemplate webservice, the TcmDebugger executes the template locally allowing for debugging.

Details

When the template builder runs a template it connects to the CompoundTemplate webservice located at http://<cmshost>/templating/compoundtemplatewebservice.asmx.

This webservice allows the template building to list and retrieve information of Tridion content.

Once a debug session is started the template builder will submit a template render request to the webservice which will start the debugging session in a separate thread.

After this the Template builder application will regularly poll for updates and retrieve both processing logs and package contents for each step of the rendering process.

The debug session constructor looks like this:

public DebugSession(
    string sessionId,
    string compoundTemplateUri,
    string compoundTemplateContent,
    string itemUri,
    string packageContents,
    bool preview,
    string publicationTargetUri,
    string userName,
    bool logTridionClasses,
    TraceEventType logLevel);

The parameters are as follows:

  • sessionId

    Unique session ID, for TcmDebugger this is a Guid.

  • compoundTemplateUri

    The TCM Uri of the template that is to be executed.

  • compoundTemplateContent

    The content of the compound template TBB (template building block) to be executed. TcmDebugger retrieves this content using the CompoundTemplateWebservice.ReadItem function.

  • itemUri

    The TCM Uri of the item the template is executed against

  • packageContents

    The package contents (as XML) to start the templating process with, TcmDebugger always starts with an empty package.

  • preview

    Switch which determines if preview mode or rendering mode is enabled

  • publicationTargetUri

    Render the template as-if as specific target is selected, by default TcmDebugger passes tcm:0-0-0 (preview target), but a specific publication target can be specified from the command line.

  • userName

    Tridion user the template is executing under

  • logTridionClasses

    Switch which instructs the Tridion templating process to output its internal logging. This can be handy when debugging complicated templating issues.

  • logLevel

    One of Verbose, Information, Error or Critical. Identical to the log level menu in the template builder application.

Once the session has been created, the templating process can be started in a separate thread:

debugSession.Start();

While the templating process is running in the remote thread, TcmDebugger waits on results:

while (debugSession.IsRunning())
{
   debugSession.GetLogMessagesXml(....)
}

Once the templating process is done TcmDebugger will retrieve the final execution status and the package output.

debugSession.GetExecutionStatusXml(....)
debugSession.GetPackageXml(....)
debugSession.GetPackageItemXml(....)

After the package is retrieved, the debugSession can be closed:

debugSession.Stop()

Clone this wiki locally