Showing posts with label Issues. Show all posts
Showing posts with label Issues. Show all posts

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>


Wednesday, June 12, 2019

Missing links on webMethods Administrator UI

Missing Links

There are a set of links at top right if you login Administrator UI. For example you can click Help link to view build-in documents based on what page you're viewing.
But in some of versions or some of pages, these links are missing.

Top.dsp

The reason is there is a missing %end% tag in DSP page "top.dsp" under WmRoot package. On version 9.9 this issue occurs between line 156 to 180.

156      %invoke wm.server.query:getLicenseSettings%
157      %ifvar keyExpired%
158      <TD width=100% class="keymessage">
159        <center>
160          <A  class="keymessage" HREF="settings-license-edit.dsp" TARGET="body">
161            License Key is Expired or Invalid.
162          </A>
163        </center>
164      </TD>
165      %else%
166      %ifvar keyExpiresIn%167      <TD width=100% class="keymessage">
168        <center>
169          &nbsp;
170          <A class="keymessage" HREF="settings-license-edit.dsp" TARGET="body">
171      %ifvar keyExpiresIn equals('0')%
172            License Key expires today.
173      %else%
174            License Key expires in about %value keyExpiresIn% days
175      %endif%
176          </A>
177        </center>
178      </TD>
179      %endif%
180      %endinvoke%

There is an obvious %end% tag missing for line 157, so what we need to do to fix it is to insert a new line like below.

156      %invoke wm.server.query:getLicenseSettings%
157      %ifvar keyExpired%
158      <TD width=100% class="keymessage">
159        <center>
160          <A  class="keymessage" HREF="settings-license-edit.dsp" TARGET="body">
161            License Key is Expired or Invalid.
162          </A>
163        </center>
164      </TD>
165      %else%
166      %ifvar keyExpiresIn%167      <TD width=100% class="keymessage">
168        <center>
169          &nbsp;
170          <A class="keymessage" HREF="settings-license-edit.dsp" TARGET="body">
171      %ifvar keyExpiresIn equals('0')%
172            License Key expires today.
173      %else%
174            License Key expires in about %value keyExpiresIn% days
175      %endif%
176          </A>
177        </center>
178      </TD>
179      %endif%
         %endif%
180      %endinvoke%

Monday, May 27, 2019

Connect to SFTP with both password and key on webMethods

Problem

I couldn't recall since when webMethods starts to support SFTP client. Maybe version 9? It's a great feature, so we could connect to SFTP server easily, but it's not perfect. To connect with a SFTP server, we need to configure a User Alias first, but we could only select either Password or Public Key as the Authentication Type. What if your server is asking for both? You will get an Auth fail exception when you try to login.

Reason

When servicpub.client.sftp:login is invoked, it will call method public Session SFTPClientManager.login(String userAlias) to establish the connection with SFTP server based on the User Alias information. The connection would be established differently based on your choice on Authentication Type field, but none of them would handle both Password and Public Key correctly.

Solution

What you need is a customized login service which could retrieve Password and Public Key from User Alias and handle them correctly. With that you could even reuse the generated Session with other services under pub.client.sftp folder as a native one.
To use this customized login service, you will need to:

  1. Create a SFTP User Alias on IS Administrator UI as usual.
  2. Make sure this User Alias is configured twice for different Authentication Type. For example, firstly you configure it to use Password, and after saving, modify it to use Public key.
  3. Invoke servicHxEnhancedSftpClient:login to connect to SFTP server by the given User Alias you created in step 1. This service has the exactly same service signature with pub.client.sftp:login.
You could download this package form GitHub, https://github.com/dingago/HxEnhancedSftpClient. The code is verified on webMethods 9.9 and CrushFTP 9.

Comments

  • If you're having issue Invalid private key, you probably need to regenerate the private key in PuTTY format, which is generate by PuTTYgen.
  • If you're having issue The cipher 'xxx' is required but it is not available, you probably need to replace current JCE jars.

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...