IBM BPM: Debugging a CSHS

 In Business Process Management, Enablement, IBM BPM, Tutorials

When working with BPM human services, specifically Client Side Human Services, we often want to be able to debug JavaScript code which runs within them.  This can be code that you have added which performs some piece or fragment of logic.  Since the code is running in your browser, we need to leverage a browser based debugger.  Fortunately, such debuggers are built into the fabric of modern browsers.  However, when we try it, we will find there is a problem.  Within Client Side Human Services the code that is executed has been dynamically inserted into the page.  Imagine we create a Human Service, that is merely data stored in a database at the BPM server.  When the page is rendered to the user’s browser, that data is streamed to the browser which interprets its content.  Putting it simply, the content sent to the browser doesn’t come from a file such as an HTML file or a JavaScript file, but was instead streamed by BPM.  The impact of this is that when we perform source level debugging, the browser debugger doesn’t properly know how to display the source statement that are being executed.  It doesn’t know which file to present.  From a practical standpoint, this results in a debugging output that shows no code … which is less than useful.  What we need is a solution to this puzzle.  The following video illustrates the problem and presents an elegant solution.

To recap what the video showed … if we add the special/magical comment into our JavaScript code of the form:

//# sourceURL=filename.js

then when the browser hosted debugger stops within code in that segment, the debugger will believe that the code came from a fictitious file with the name supplied.  The user will be presented with the source contained a tab with that given file name.

See also:

Recent Posts
Contact Us

Want to get in touch with us? Send us an email and we'll get back to you as soon as possible.

Not readable? Change text. captcha txt

Start typing and press Enter to search