Skip to content

StefanMacke/ao-integrationserver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ao-integrationserver

A nicer Java interface for webMethods Integration Server services.

Calling Integration Server services from Java is quite complicated. You need to generate code with Software AG Designer and manually edit it to fit your needs. The generated class to call the simple service pub.date.formatDate is already 158 lines long. Additionally, the services use webMethods' internal data format IData for input and output parameters, which is quite complicated, too.

Wouldn't it be nice, if we could call an Integration Server service with a simple POJO as input parameter and have it return a POJO, too? With ao-integrationserver you can! All you have to do is create a class that represents the service and defines its input and output parameters as static inner classes like so (for pub.math.max):

public class max extends Service<max.Input, max.Output>
{
    public static class Input extends ServiceInput
    {
        public String[] numList;
    }

    public static class Output extends ServiceOutput
    {
        public String maxValue;
    }
}

The input and output classes can use type-safe attributes and even Getters and Setters. Internally, ao-integrationserver uses ao-idata-converter to convert POJOs from and to IData.

If you follow some naming conventions in your Java and Integration Server packages, that's all that's needed to be able to call the service like so:

max sut = new max();
max.Input input = new max.Input();
input.numList = new String[]
    { "2", "4", "3", "1" };
max.Output output = sut.call(input);
assertThat(output.maxValue, is("4.0"));

However, if you don't follow the recommended naming conventions (i.e. class name == service name, package name == Integration Server namespace etc.), every service can individually be configured, i.e. its package, namespace, name etc. can be defined by overriding some predefined methods.

You can define the target host (e.g. development vs. production) and the user credentials for the service call individually for each service or via a central .properties file:

integrationserver.admin_username=Administrator
integrationserver.admin_password=manage
integrationserver.host_development=localhost:5555
integrationserver.host_test=test-esb:5555
integrationserver.host_production=prod-esb:5555
integrationserver.target_server=Development

With this framework we are able to call a new Integration Server service from Java and even test it with JUnit within a few minutes.

Usage

You need to have some additional libraries on the classpath:

  • [COMMON DIR]/lib/wm-isclient.jar (from webMethods Integration Server)
  • [COMMON DIR]/lib/ext/enttoolkit.jar (from webMethods Integration Server)
  • [COMMON DIR]/lib/glassfish/gf.javax.mail.jar
  • ao-idata-converter.jar (from ao-idata-converter)

I have already included them in the project's dependencies (build.gradle) if you provide them via your artifact repository (e.g. Artifactory or Nexus).

Examples

Take a look at these two classes to see ao-integrationserver in action (for service pub.string.length in WmPublic):

About

A nicer Java interface for webMethods Integration Server services.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages