HTTP Interceptor in WebMethods

Overview :


SoftwareAG provides a framework to create and register the HTTP interceptor which intercepts all received HTTP requests and outbound HTTP responses.
It provides methods that we can use effectively to capture the HTTP call passes through the integration server. This article will help you to write code to implement the methods exposed by webmethods effectively.

HTTP Interceptor Architecture :


http Interceptor architecture diagram

As you can see in the above diagram, the interceptor is something that comes in between the request and the response passes through the integration server. Webmethods provides interfaces that we can implement and write customized logic that will trigger whenever an HTTP call passes through IS.

To create an HTTP inbound interceptor in webMethods, develop a class that implements the HTTPInterceptorIFC interface. For the outbound interceptor, implement the HttpInterceptorOutboundIFC interface. Within these classes, override the preProcess and postProcess methods, incorporating your custom logic using the provided parameters.

preProcess: The preprocess method is called for HTTP requests in webMethods. For inbound interceptors, it handles requests received by the Integration Server, while for outbound interceptors, it manages requests sent by the Integration Server.

postProcess: The postProcess method is called for HTTP responses. For inbound interceptors, it handles responses sent by the Integration Server. For outbound interceptors, it manages responses received by the Integration Server.

Pros and Cons of HTTP Interceptor :


Pros of HTTP Interceptor :

  • Enable us to capture the request and response passes through the integration server.
  • Enable us to execute custom logic on each invocation.
  • We can prevent the request by raising an exception using HttpInterceptorException.

Cons of HTTP Interceptor :

  • We can register only one HTTP interceptor per Integration Server.
  • HTTP interceptor delays sending the response.
  • We can’t modify the content of the HTTP request or response. 

Implementation :


  • Create a Java project and include the ‘enttoolkit.jar‘ from the ‘C:/SoftwareAG/IntegrationServer/lib/jars/‘ directory and ‘wm-isclient.jar‘ from ‘C:/SoftwareAG/common/lib/‘ directory in the project’s build path. Note that the actual paths may vary depending on your installation directory.
  • Create two classes one for inbound interceptor and one for outbound interceptor and implement HTTPInterceptorIFC interface for inbound interceptor and implement HttpInterceptorOutboundIFC interface for outbound interceptor.
  • Override preProcess and postProcess methods in both the classes.
  • Write custom logic using the parameters to process in run time, for more information please click here to check out the documentation.
  • Once your implementation is done export the Java project as a jar file along with class files and resources.

Download resources :


As part of this project, we have developed a sample code that calls the respective service with parameters. You can customize this code within the service itself based on your specific requirements. Please note that the provided code is for illustrative purposes and serves as a starting point for customization.

  • JAR file.
    Download resource
  • Package required to accept parameters from the Java service.
    Download resource

Configuration :


  • Place the jar that you have exported or downloaded to any of the below locations.
    • Software AG_directory \ Integration Server_directory \instances\instanceName\lib\jars\custom
    • Software AG_directory \ Integration Server_directory \lib\jars\custom
    • Software AG_directory \ Integration Server_directory \instances\instanceName\packages\packageName\code\jars\static
  • Open the extended setting in the integration server administrator page and set the following properties.
    • Set watt.server.http.interceptor.enabled property to true to use inbound HTTP interceptor.
    • Set watt.server.http.interceptor.impl property with the full qualified name of the class which is implementing HTTPInterceptorIFC, if you are using the jar that you have downloaded from above then set it to com.harmonigate.is.interceptor.HttpInboundInterceptor.
    • Set watt.server.http.interceptor.preprocess.sizeLimit property to define a size limit on the requests that will be handled by the inbound interceptor, set it to -1 to accept all.
    • Set watt.server.http.interceptor.outbound.enabled property to true to use outbound HTTP interceptor.
    • Set watt.server.http.interceptor.outbound.impl property with the full qualified name of the class which is implementing HttpInterceptorOutboundIFC, if you are using the jar that you have downloaded from above then set it to com.harmonigate.is.interceptor.HttpOutboundInterceptor.
  • After completing the above steps, restart the Integration Server. If you are unsure about the steps required to restart the server, click here to check out the article on the same.

Testing :


We have completed the necessary configuration required to utilize the HTTP interceptor. To test this implementation, create a SOAP project and call it via SOAP client and flow service. You will see the request and response in the server log. In case you are not aware of how to work with web service please click below link to check out the same.

2 thoughts on “HTTP Interceptor in WebMethods”

Leave a Comment