Question
Rochdi Badis · May 16

Handling HTTP requests with InboundAdapter

Hi Guys,

I currently have a service that uses an InboundAdapter to get a JSON file and process it given that the client is pushing data to us, but now we have another client where we need to request the JSON file by sending a HTTP request then get the file and process it, kind of a Get rather than push, how can I create a service that handle that?

 

 

Thanks

 

Product version: Ensemble 2014.1
0
0 84
Discussion (1)2
Log in or sign up to continue

While technically this could be written using a custom class extending Ens.BusinessService, what you describe has you playing the 'Operation' role more than the 'Service' role. We do this with many integrations and have a design pattern that works well for us.

In short, you need:

  • Custom Adapterless Trigger Service (extends Ens.BusinessService). Only purpose is to send a simple Ens.Request to a Busines Process (BPL of custom class that extends Ens.BusinessProcess) on a timed interval... either using a schedule or the call interval.
  • Custom Business Operation likely extending EnsLib.HTTP.GenericOperation or something similar.
  • Custom Business Process to handle the business logic flow...
    • at time of Ens.Request from the trigger service, it formats a request object and sends to the Business Operation that executes your GET call against the webservice to receive the JSON payload.
    • JSON Payload returned by Business Operation to the Business Process as a custom message object ideally (no longer JSON) and from there, any manner of normal Ensemble workflows can take place (data transforms, ID logic, call outs to other business operations and so forth.)

You appear to be on a very old version of Ensemble so not sure how much recent documentation will be relevant to your use case and you likely will face a lot more difficultly using Ensemble 2014.1 than you would with something 2019.x or newer, but here's a few reference links to get the thought processes going:

Using the HTTP Outbound Adapter | Using HTTP Adapters in Productions | InterSystems IRIS for Health 2021.2

Creating REST Operations in Productions | Using REST Services and Operations in Productions | InterSystems IRIS for Health 2021.2