Externalize Java helper methods with access to the service pipeline of webMethods Integration Server

As I’ve mentioned earlier, I like to re-use my existing code whenever possible (and if not possible I’ll try to find a way ;-)). When writing Java Services in webMethods’ Integration Server, I wanted to use an existing method that provides easy access and type safety when working with the service pipeline (i.e. interface IData). The problem was, that Software AG Designer (i.e. Eclipse) didn’t “know” the needed interfaces etc. to compile the source code locally (!). As it turns out, all you have to add to your Java project to program against Integration Server’s API is a single JAR file. However, to find this particular JAR file you have to dig deep into the Designer’s installation folder. I found it here: [...]\SoftwareAG\eclipse\v36\plugins\com.webmethods.process.model.upgrade.impl_8.2.2.0000-0211\lib (you’ll have to adjust the path to your version of IS) and it’s called client.jar. After adding the JAR file to the Eclipse project’s CLASSPATH I was able to externalize my short helper function into its own project and re-use it in all my Java Services. Here’s my code of a type safe access method for the pipeline:

public static <T> T getInputParameter(IData pipeline, String paramName) throws ServiceException
{
  IDataCursor pipelineCursor = pipeline.getCursor();
  Object paramValue = IDataUtil.get(pipelineCursor, paramName);
  pipelineCursor.destroy();

  if (paramValue == null)
  {
    throw new ServiceException("Required parameter <" + paramName + "> not set.");
  }

  try
  {
    return (T)paramValue;
  }
  catch (ClassCastException e)
  {
    throw new ServiceException("Required parameter <" + paramName + "> could not be casted.");
  }
}

2 thoughts on “Externalize Java helper methods with access to the service pipeline of webMethods Integration Server”

  1. Hi Strefan

    Thanks for the post.

    I know this is not the main topic of this post but it’s part of it. Functionality provided by code such as the getInputParameter method you created is a recurrent need. Unfortunately out-of-the-box webMethods libraries don’t provide such functionality.

    In order to address this and other limitations, we created a free and open source library: https://github.com/innodev-au/wmboost-data

    It’s applicable in cases where you want to retrieve/set document values with imperative code.

    Regards,

    Juanal.

Leave a Comment

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax