Thursday, June 20, 2019

Enhanced DSP on webMethods

DSP

DSP (Dynamic Server Pages) is a powerful tool for developer to build dynamic web pages on webMethods Integration Server. Actually every single page you see on Administrator UI is a DSP page. It contains a set of pre-defined tags, to allow you to invoke a service or display a value in pipeline.

What Is Wrong with DSP

Firstly, the number of tags DSP supports seems not changing, since we have more and more new features on Integration Server. It looks like nobody still maintains it.
Secondly, there is an obvious mistake for ifvar tag. In any "Dynamic Server Pages and Output Templates Developer’s Guide" it says the match option is to match a regex pattern. But that's not true, it's trying to match a glob pattern.

Enhanced DSP

The DSP is not as open as other components on Integration Server. Which means it's not easy to change how it works. What kind of tags are supported is hard-code defined in class com.wm.util.template.TemplateTokenizer based on tag name. And how do these tags work is defined in individual class under package com.wm.util.template. To enhance DSP, the only option I have is to replace the class. I prefer to use javassist to avoid changing on original jar files, but only add new jar file to override the behaviors.
I developed a sample project to:
  1. Add a customized argument on ifvar tag, to support regex pattern.
  2. Add a customized tag to support reading global variables.
Of course you could do a lot more than that. You could download it from GitHub, https://github.com/dingago/HxEnhancedDSP. The code is verified on webMethods 9.9.

What Does It Look Like

<HTML>
<BODY>
%invoke TestEnhancedDSP:getValue%
value = %value value%
<br>
pattern = ^test.*$
<br>
%ifvar value matches('^test.*$')%
regular matches = true
%else%
regular matches = false
%endif%
<br>
%ifvar value regexmatches('^test.*$')%
regex matches = true
%else%
regex matches = false
%endif%
%endinvoke%
</BODY>
</HTML>


<HTML>
<BODY>
Global variable "demoServer" = %gv demoServer%
</BODY>
</HTML>


No comments:

Post a Comment

Extendable System Monitor on webMethods

System Connectivity Monitoring There could be hundreds of systems integrated in a big company, and it's a challenge for administrator...