Designing and Implementing Composite Applications : Getting Started with the webMethods Application Platform API : Using the Application Platform API : Exposing POJO classes as Integration Server Assets
Exposing POJO classes as Integration Server Assets
This section describes the annotations you can use for exposing POJO classes as Integration Server assets.
@ExposeToIS
This annotation is used to identify a class that contains one or more methods to be exposed as Integration Server services. It is combined with the @Service and @ExposedMethod annotations to support the presentation of methods in a Java POJO as IS services. Since the generated Integration Server assets assume that the Java class is registered in OSGi as a service, this annotation must be used with the @Service annotation.
For example:
@ExposeToIS(packageName="OrdersService") 
public class OrdersServiceImpl implements OrdersService { 
The following table lists the properties of @ExposeToIS:
Property
Default Value
Description
packageName
""
String Optional. The name of the Integration Server package where services from this class are created. Note that this is the name of an Integration Server package, not a Java package. If no value is provided, when the Integration Server service is generated, the value of the @Service.name property will be used as the Integration Server package name.
@ExposedMethod
This annotation identifies a method to be exposed as an Integration Server service. It is valid only on public methods. Since Integration Server does not support service name overloading, there are restrictions on exposing methods from a Java class. If the exposed Java class defines methods using overloaded names, only one method with a given name can be exposed.
This annotation has no properties.
For example:
@ExposedMethod 
public String createReceipt(Order inOrder) { 
Example of Using the @ExposeToIS and the @ExposedMethod Annotations
In the following example the OrdersServiceImpl class implements the OrdersService interface, which declares several methods, including @ExposeToIS and @ExposeToIS. When this POJO is published in an Application Platform project, several artifacts are created in the Integration Server namespace.
As a result of the packageName property, an Integration Server package, named OrdersService is created, if necessary. Based on the name of the Java package, where the OrdersService interface is defined, a folder, named 'com.softwareag.demp.orders.api', is created. This folder is located in the new Integration Server package.
Each of the exposed methods creates an Integration Server service in the new folder. The service name matches the exposed method name. The signatures for these new IS services match the method signatures. For example, the orderReceipt service signature includes a String output and one input of type Document, named inItem, where the document structure matches the properties of the Order POJO.
package com.softwareag.demo.orders.impl; 
 
@Service(name="RegisteredOrdersService", interfac-
es={"com.softwareag.demo.orders.api.OrdersService"}) 
@ExposeToIS(packageName="OrdersService") 
public class OrdersServiceImpl implements OrdersService { 
 
      @Override 
      @ExposedMethod 
      public float calculateCharge(LineItem inItem) { 
             .... 
      } 
 
      @Override 
      @ExposedMethod 
      public String createReceipt(Order inOrder) { 
... 
      } 
  } 
 
public interface OrdersService { 
      public String createReceipt(Order inOrder); 
      public float calculateCharge(LineItem inItem); 
      ... 
If the packageName property is omitted from this example code, the package in the Integration Server namespace will be named RegisteredOrdersService, based on the @Service annotation.
Copyright © 2016- 2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback