Home Applications iris-http-calls

iris-http-calls

This application is not supported by InterSystems Corporation. Please be notified that you use it at your own risk.
5
1 reviews
0
Awards
38
Views
0
IPM installs
0
0
Details
Releases  (14)
Reviews  (1)
Issues
Dependencies  (3)
Interoperability Adapter and Service for making HTTP calls

What's new in this version

Use File Service to send files to BPL

Gitter
Quality Gate Status
Reliability Rating

iris-http-calls

This is an InterSystems IRIS Interoperability solution for HTTP calls

Implements Idea DPI-I-456

Idea

What The Sample Does

This sample was cloned from iris-interoperability-template. I have reconfigured the interoperability Production with an Inbound HTTP Adapter which is used by a HTTP Business Service.
I configured Call Interval setting to call HTTPServer once every hour. You can change both the URL and frequency in the service’s settings.
Screenshot

Originally the HTTP Service had two targets. The response body from each call was sent as a HTTP Generic Message to a BPL business process and also a file operation which saved data to a folder iris-http-calls.

Now the HTTP Service sends a HTTP Generic Message to a file operation. Then a file service sends the file to a BPL business process.

Prerequisites

Make sure you have git and Docker desktop installed.

Installation: ZPM

Open IRIS Namespace with Interoperability Enabled.
Open Terminal and call:
USER>zpm “install iris-http-calls”

Installation: Docker

Clone/git pull the repo into any local directory

git clone https://github.com/oliverwilms/iris-http-calls.git

Open the terminal in this directory and run:

docker-compose build
  1. Run the IRIS container with your project:
docker-compose up -d

How to Run the Sample

Open the production and start it if it is not already running. It makes HTTP calls to HTTPServer using URL.

How to alter the template

This repository is ready to code in VSCode with the ObjectScript plugin.
Install VSCode, Docker and ObjectScript plugin and open the folder in VSCode.

Use the handy VSCode menu to access the production and business rule editor and run a terminal:
Screenshot 2020-10-29 at 20 15 56

environment variables usage

this example shows how you can introduce env variables in your dev environment.
Suppose you need to setup the production with some secret token to access a limited access API.
Of course you don’t want to expose the secret to GitHub.
In this case Env variables mechanism could be helpful.
First introduce .env file and setup .gitignore to filter .env from git.

Then add the secret token in .env in a form ENV_VARIABLE=“TOKEN VALUE”

Next introduce make environment variables be imported to dockerfile. to make it work add the environment section into docker-compose.yml, .e.g:

environment:
      - SAMPLE_TOKEN=${SAMPLE_TOKEN}

Then you’ll be able to init the running container with the data from env variables e.g. with the following call, which uses the value from .env file as a setting of the production:

USER> d ##class(dc.Demo.Setup).Init($system.Util.GetEnviron("SAMPLE_TOKEN"))

package manager production parameters

Users of this module can use parameters to pass data to the module during installation and customize the File Path for the file operation and file service as well as modify URL.
it can be useful when setup parameters are secret tokens to access particular API.
You as a developer can provide such parameters with default tag in module.xml.

<Default Name="FilePath" Value="iris_http_calls" />
<Default Name="UrlModify" Value="/Patient?_id=egqBHVfQlt4Bw3XGXoxVxHg3" />

These default parameters enable users to call the installation of the package with the option of passing of parameters. E.g. the installation call could be run as:

zpm "install iris-http-calls -D FilePath=iris_http_calls -D UrlModify=/MedicationStatement?patient=egqBHVfQlt4Bw3XGXoxVxHg3"
USER>zpm "install iris-http-calls -D FilePath=iris_http_calls -D UrlModify=/MedicationStatement?patient=egqBHVfQlt4Bw3XGXoxVxHg3"

[USER|iris-http-calls] Reload START (/usr/irissys/mgr/.modules/USER/iris-http-calls/0.3.37/)
[USER|iris-http-calls] Reload SUCCESS
[iris-http-calls] Module object refreshed.
[USER|iris-http-calls] Validate START
[USER|iris-http-calls] Validate SUCCESS
[USER|iris-http-calls] Compile START
[USER|iris-http-calls] Compile SUCCESS
[USER|iris-http-calls] Activate START
[USER|iris-http-calls] Configure START
[USER|iris-http-calls] Configure SUCCESS
[USER|iris-http-calls] Activate SUCCESS

The default parameters are used to setup the production in the following call:

<Invoke Class="dc.Demo.Setup" Method="Init" >
  <Arg>${FilePath}</Arg>
  <Arg>${UrlModify}</Arg>
</Invoke>

Method Init in dc.Demo.Setup class configures File Service and File Operation using the FilePath parameter. The UrlModify parameter is used to modify the URL setting of the HTTP service.

Made with
Install
zpm install iris-http-calls download archive
Version
0.3.7814 Dec, 2024
Ideas portal
https://ideas.intersystems.com/ideas/DPI-I-456
Category
Technology Example
Works with
InterSystems IRISInterSystems IRIS for HealthEnsemble
First published
10 Dec, 2024