[InterSystems IRIS for the First Time] Interoperability: What a Production is
Tags: beginners, programming, tutorial, interoperability
Published: 2022-10-23 13:48:16

**This article is a continuation of <a href="https://community.intersystems.com/post/intersystems-iris-first-time-interoperability-lets-learn-how-it-works" target="_blank">this post</a>.**

In the <a href="https://community.intersystems.com/post/intersystems-iris-first-time-interoperability-lets-learn-how-it-works" target="_blank">previous article</a>, how the Interoperability menu works for system integration was explained.

In this article, I would like to explain how to develop a system integration using the Interoperability menu.

To begin with, what kind of process do you want to create? While thinking about this, make the following content.

* <span style="color:#c0392b;"><strong>Production</strong></span>
* Message
* Components
  * Business Services
  * Business Processes
  * Business Operations

<span style="color:#c0392b;"><strong>Production</strong></span> is <u><strong>a definition used to specify the components required for system integration and to store the component settings, </strong></u>which are configured using the Management Portal (internally stored as a class definition for Production).

For example, suppose you are creating a business service that processes files placed in a specified directory at regular intervals. In that case, it is necessary to set up exactly which directories to monitor and which files to process. A <span style="color:#c0392b;"><strong>Production</strong></span> is prepared to store these settings.

The settings depend on the **adapter** used by the component that sends and receives data.

<p style="margin-left: 40px;">
<strong>Adapters</strong> are classes to simplify the connection to external systems, some are protocol-specific such as Mail/File/SOAP/FTP/HTTP/SQL/TCP, and some are standards specific HL7.
</p>

<p style="margin-left: 40px;">
Please refer to the documentation (<a href="https://docs.intersystems.com/irisforhealthlatest/csp/docbook/Doc.View.cls?KEY=SETAdapters" target="_blank">protocol-specific adapters</a> and <a href="https://docs.intersystems.com/irisforhealthlatest/csp/docbook/Doc.View.cls?KEY=SETEDIGuides" target="_blank">adapters related to EDI documentation</a> for more information on adapters.
</p>

Since we will define the necessary components for the **<span style="color:#c0392b;">Production</span>**, <span style="color:#c0392b;"><strong>"Start Production"</strong></span> will start the system integration, and <span style="color:#c0392b;"><strong>"Stop Production"</strong></span> will stop the system integration.

The development required to complete the <span style="color:#c0392b;"><strong>Production</strong></span> is the creation of the components necessary for system integration, specifically the following contents:

* Message
* Components (Business Services, Business Processes, Business Operations)
* Data conversion, etc.

The content above will be explained slowly in the articles coming after this one.

First of all, let's start <span style="color:#c0392b;">**Production**</span> using the sample <span style="color:#c0392b;">**Production**</span> and check the message process by processing data while checking the settings.

Sample can be downloaded from <a href="https://github.com/Intersystems-jp/selflearning-interoperability" target="_blank">https://github.com/Intersystems-jp/selflearning-interoperability</a>.

<u><strong>To use a Container</strong></u>, download the sample code using the git clone, navigate the clone's directory, and run <span style="color:#8e44ad;"><strong>docker-compose up -d</strong></span>  It's that easy!

See <a href="https://github.com/Intersystems-jp/selflearning-interoperability#%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6" target="_blank">here</a> for the procedure (it will take some time to create a container).

<u><strong>If you do not use containers</strong></u>, create a new namespace after downloading the sample, and import all class definition files (extension .cls) under the src folder into the created namespace.
For more information on the process of creating a namespace, please refer to the video after 07:03 of <a href="https://jp.community.intersystems.com/node/478601" target="_blank">this article</a>.

Please refer to the <a href="https://github.com/Intersystems-jp/selflearning-interoperability" target="_blank">README</a> for more details on the sample code.

When you are ready, access the management portal (change the web server's port number to match your environment).

**<http://localhost:52773/csp/sys/UtilHome.csp>**

Go to the **Management Portal > Interoperability > Configuration > Production**.

If you are using a method other than containers, connect to the namespace where you imported the source code, access <strong>[Configuration] > [Production]</strong>, click the <strong>[Open]</strong> button, select <strong>[Start] > [Production]</strong>, and then click the <strong>[Start]</strong> button.

<p>
※ If you are using something other than a container, you will need to make some initial settings. Please set up the <a href="#local">contents described below</a> before trying the following contents.
</p>


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p6x8so9kkg1pxa2l2pli.png)

The production page will be displayed as  **[**<span style="color:#2ecc71;">●</span> **Component Name]** for each of the "Service", "Process", and "Operation" components.

Click on the component name to change the contents of the "Settings" tab on the right side of the screen.

For example, when you click on **Start.GetKionOperation** (single click), the display is as follows.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/56kf8jaww3qcn5rbtavm.png)

This component has the [HTTP Server] and [URL] settings for connecting to the Web API. 
There is a [appid] field at the bottom of the settings where you can enter the API key that you get it.
There is a [lang] field near [appid] and is set "ja" ("ja" = Japanese). [lang] set language of response from OpenWeather. For English, set "en".
When you finish to set these settings , click the "Apply" button.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9rjyrcoqggzcjdve04ln.png)

If you are using a container, the setup is complete. For more information, please click [here](#datasend).

* * *

#### <u>If you are experimenting with something other than containers<a id="local" name="local"></a></u>

Please make the following two settings in advance:

1)　Configure the SSL client.

Since the Web API to be connected to will be communicated using HTTPS, configure the SSL client on the IRIS side in advance.

To match the settings of the sample production, we will use the name **[openweather]**. The settings in the Production are as follows:



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cxuv7uju171lg0grhc05.png)

**Click the Management Portal > [System Administration] > [Security] > [SSL/TLS Configuration] > [Create New Configuration]** button, enter **"openweather"** in the "Configuration Name" field, and then click in the "Save" button to finish.



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tkzd5wb1w8s962s6ue0n.png)

<p style="margin-left: 80px;">
</p>

2)　Create a base URL for REST

<p style="margin-left: 40px;">
</p>

In the sample production, we have configured it so that the information can be entered via REST, and the base URL for REST needs to be configured on the IRIS side.

In the sample, we set /start as the base URL. Since the Start.REST class exists in the namespace where the sample was imported, we will specify this class as the dispatch class and add %All as the application role to omit authentication at the time of access.

**Management Portal > System Administration > Security > Applications > Web Application Path > Click the "Create new web application"** button.

In the Name field, specify **/start**; in the Namespace field, specify the namespace from which the sample was imported; in the Dispatch Class field, specify **Start.REST**; in the Allowed Authentication Method field, select **"Unauthenticated"**, and save the file.

After saving, add the **%All** role to the **application role** on the "Application Roles" tab.



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/euv6b4fw59nqkbpkdt9b.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lspw2h0k7i6updp4khu2.png)

* * *

### <a id="datasend" name="datasend"><strong>Try to send data</strong></a>

Once you are all set up, try to use a business service to send information via REST and let it run.

<http://localhost:52773/start/weather/Takoyaki/Osaka>

The above example is a URL that supposes that someone has purchased "Takoyaki" in Osaka City.

The screen after execution is as follows.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a9dffvks8bd6rgztt75y.png)

Check the messages that have been sent to the **<span style="color:#c0392b;">Production</span>**.

In the **Management Portal > Interoperability > Configuration > Production**, click on the service below:
![](https://jp.community.intersystems.com/sites/default/files/inline/images/images/image(1060).png)

Select the <span style="color:#16a085;">**"Messages"**</span> tab on the right side of the screen and click on any number below to the header field column. If you do not see it, reload your browser.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3ps7yjdx2q1bvtj2h62m.png)

Using the Visual Trace page, you can see the information of <span style="color:#16a085;">**messages**</span> sent and received between components. You can see that the weather information is retrieved from the Web API and sent back in the <span style="color:#3498db;">**light blue frame**</span>.

In this way, you can use tracing to see what data was being sent and received at that time and in what order.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s1untihjyrdfulyz29x5.png)Throughout this article, we have confirmed that <span style="color:#c0392b;">**Production**</span> has defined the necessary components and their settings for system integration by referring to the sample code settings.

We also confirmed that we could refer to the messages flowing through the <span style="color:#c0392b;">**Production**</span> in chronological order by using the Visual Trace page.

In the next articles, we will discuss the concept behind creating the **<span style="color:#16a085;">"message"</span>** shown in this trace and how actually to define it.