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.");
}
}
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.
Hi juanal,
thanks for the URL. I’ll take a look at your framework!
Best regards,
Stefan