#Business Service

0 Followers · 209 Posts

A business service is part of InterSystems Ensemble interoperability production which is responsible for accepting requests from external applications.

Article Eduard Lebedyuk · Aug 12, 2020 3m read

Productions often need to receive REST requests.

Here's how to do that.

1. Create proxy Service:

/// Empty BS we would use to send Produciton requests
Class production.ProxyService Extends Ens.BusinessService
{
}

2. Add it to production as RESTService (or any other name).

3. Write your rest broker (docs, more docs)

4. In your handler method create the message and call target BP/BO like this

8
1 1106
Article Eduard Lebedyuk · Aug 7, 2020 5m read

In this article, I will show how you can easily containerize  .Net/Java Gateways.

For our example, we will develop an Integration with Apache Kafka.

And to interoperate with Java/.Net code we will use PEX .

Architecture

Our solution will run completely in docker and look like this:

Java Gateway

First of all, let's develop Java Operation to send messages into Kafka. The code can be written in your IDE of choice and it can look like this.

In short:

7
1 1401
Question Purushothaman Thirugnanasambandam · May 11, 2021

I have a requirement to update the Ensemble Host Settings Programmatically.  Mainly the "AlertOnError,QueueCountAlert,QueueWaitAlert,InactivityTimeout" settings.
I used Ens_Config.Item (persistent) class to get the settings (list object) and then update it. But for some of the Business Host's, I dont see the above settings in the table, but present in Settings of that particular Host in Ensemble Management Portal. So my logic is not working.

Why is that and how to write a code to update the above settings for all the hosts ?

Please let me know the way to achieve my requirement.

My code.

11
0 743
Article Mihoko Iijima · Mar 5, 2021 9m read

This article is a continuation of this post.

In the previous article, we discussed the development of business processes, which are part of the components required for system integration and serve as a production coordinator.

This article will discuss creating a business service, which is the information input window for production.

And finally, the last component of “Let's Use Interoperability!”

The business service provides a window of input for information sent from outside IRIS, with or without using the adapter for external I/F.

There are three types of business services in the sample (links in parentheses are links to the sample code):

  1. Business services for files using inbound adaptersStart.FileBS
  2. Business services for Web services using the SOAP inbound adapterStart.WS.WebServiceBS
  3. Business service called by stored procedure or REST without using an adapterStart.NonAdapterBS

Different connection methods used for inputting information will only increase the number of business services; however, the processing done within a business service is

Create a request message to be sent
using externally inputted information and
simply call the business component

It's effortless.

Now, let's outline how to create components that use file-inbound adapters.

Business services are written in scripts, which can be created in VSCode or Studio (see this article on using VSCode).

1. Business services for files using inbound adapters(Start.FileBS

If you create a class in VSCode, you should create a class that inherits from Ens.BusinessService. As for adapters, you can use the ADAPTER parameter as ADAPTER class name (e.g., specify a file-inbound adapter class).
If you do not use the adapter, no configuration is required.

Class Start.FileBS Extends Ens.BusinessService
{
Parameter ADAPTER = "EnsLib.File.InboundAdapter";

In the file-inbound adapter, you can specify the directory to be monitored in Settings→File Path for the production's business service.

image

If the file located in the "File Path" matches the information specified in the "File Spec," it opens the file as a stream object. It defines it as the first variable when calling the business service ProcessInput().

When ProcessInput() is started, OnProcessInput() is automatically called. OnProcessInput() is passed directly to OnProcessInput() with the parameters passed to ProcessInput().

image

In OnProcessInput() the initial statement gets the information from the file stream object, which is passed as the first parameter, then creates a message to be given to the next component, writes the process of calling the next component, and completes the basic logic.


【Memo】
For Studio, launch the Business Services Wizard in the New Creation menu, select the adapter and press the Finish button.


The OnProcessInput() method definition is as follows:

Method OnProcessInput(pInput As %Stream.Object, Output pOutput As %RegisteredObject) As %Status

pInput is provided with an instance of the %Stream.FileCharacter class for text files or the %Stream.FileBinary class for binary files.

In the sample, a file in text format will be inputted, and we have written it to accept multi-line requests and one request per line.

AtEnd property is set to 1 when EndOfFile is deteced. You can use this property to stop loop.

In a loop, we read the lines using the ReadLine() method, which enables us to obtain information about the contents of the file one line at a time (see the documentation for file adapter details).

Compose the message, retrieving information line by line. Then, we execute the ..SendRequestAsync() method, which calls the other components.

When executing the method, the first parameter should be the name of the component you want to call as a string, and the second parameter should be the request message you have created.

Note that the ..SendRequestAsync() is an asynchronous call and does not wait for a response.

Memo:There is also SendRequestSync() for synchronous calls.。

The sample code is as follows:

image

Reference:explanation of the usage of the $piece() function in the above example text

$piece(“string”, ”delimiter mark”, ”position number”)

The function to set/get a string with a delimiter, in the sample, to get the first and second value of comma-separated data, is written with the following syntax:

set request.Product=$piece(record,",",1)
set request.Area=$piece(record,",",2)

Now, let's check the function of Start.FileBS as it appeared in the above description.

In the sample production, the "File Path" was set to /irisdev/src, and the "File Spec" was set to check.txt. Either prepare the same directory or change it to a different directory and register the sample data in the check.txt file using the following format: purchased product name, name of the city.

※If you are using the sample container, please rename [Test-check.txt] in the src directory under the directory created by the git clone.

image

image

2. Business services for Web services using the SOAP inbound adapter (Start.WS.WebServiceBS

Next, we will outline the creation of business services for Web services.

The Business Service Class for Web Services acts as a Web Service Provider = Web Service Server.

In the sample, we have two parameters in the Web service method for this sample production to have information sent from the Web service client. The web method uses the data entered in the parameters to create a message class and call other components.

image

When you define a Web service class, a test screen is created. However, it is not shown by default.

Log in to IRIS (or start a terminal), go to the namespace where the production is located and do the following:

For your reference:Access to the Catalog and Test Pages

Here is a sample code configuration in the setting where the container was started with docker-compose up -d (run in the %SYS namespace)

set $namespace="%SYS"
set ^SYS("Security","CSP","AllowClass","/csp/user/","%SOAP.WebServiceInfo")=1
set ^SYS("Security","CSP","AllowClass","/csp/user/","%SOAP.WebServiceInvoke")=1


【Attention】Please note that the sentence is case-sensitive and should be written with care. Also, depending on the namespace in which the product is used, the specified script changes. The example sentence is written on the assumption that the sample is imported into the USER namespace.
If you import the sample code into the ABC namespace, the fourth subscript should be "/csp/abc/."

Once the configuration is complete, go to the following URL:

http://localhost:52773/csp/user/Start.WS.WebServiceBS.cls

image

If you want to provide the WSDL to your Web services client, specify WSDL=1 at the end of the following URL

http://localhost:52773/csp/user/Start.WS.WebServiceBS.cls?WSDL

3. Business services called by stored procedures or REST without using adapters(Start.NonAdapterBS

Next, we will introduce the Business Service without adapters (Start.NonAdapterBS).

image

For business services that use adapters, the adapter calls the business service's ProcessInput() method to detect the information.

If you don't use adapters, you can still call the ProcessInput() method, but this method is not public. Therefore, if you implement a business service that does not use adapters, you will need to consider ProcessInput().

The sample utilizes the following two methods:

Now, here's an example of a stored procedure.

image

After adding a business service (Start.NonAdapterBS) that does not use adapters to the production (state added in the sample), run the following stored procedure

call Start.Utils_CallProduction('piroshki','Russia')

image

A resulting trace of the running result is as follows:

image

Next, here is an example of creating a dispatch class for REST:

image

The XML described in the XData Url Map defines which methods are called in response to the URL at the time of the REST call.
The example describes a definition that calls the WeatherCheck() method when the URL of the /weather/first parameter (purchased product name)/ second parameter (name of the city) are provided in the GET request.

<Route Url="/weather/:product/:arecode" Method="GET" Call="WeatherCheck"/>

Then, define the base URL for the above URL in the Management Portal's Web Application Path Settings screen, and it is complete.

See this article for more details on the configuration.

Once it is ready, try to run the information using a business service that allows you to send the REST information.

Example)http://localhost:52773/start/weather/Takoyaki/Osaka

image

image

If you do not use an adapter, as ProcessInput() cannot be called directly from outside, we have created an object for the business service in the logic executed through REST or stored procedures (using the CreateBusinessService() method of the Ens.Director class) and called ProcessInput()

If you use an adapter, the adapter detects the input and stores the information in a unique object and passes it to the business service. In contrast, if you don't use an adapter, the rest is pretty much the same, only the difference is in the above-mentioned part of the process.

The business service is simply designed to use the information entered outside IRIS to create request messages and call business components.

Throughout the sample production, we were able to see the following:

Different components play different roles in making a production run (business services, business processes, business operations).

To transmit information between components, use the message.

Messages are stored in the database unless deleted and thus can be traced at any time.

Some adapters simplify the process of around the connection.

These are the basic operations on how to use Interoperability in IRIS.

There are also record maps (see: FAQ TOPIC) and data conversion tools that are useful for input and output of CSV files and other format-specific files.

As well as this series, there is also an article on simple IoT applications developed with InterSystems IRIS using Interoperability. Please check it out.

Besides, IRIS for Health also supports FHIR and HL7 (including SS-MIX2) transmissions.

I would be pleased to explain it in another post. If you have something of interest to share, please leave a comment!

Finally, training courses are also available to learn how to use Interoperability.

If you'd like to take the time to try it out with an instructor, please consider joining one of our training courses!

0
0 751
Question Scott Roth · Feb 4, 2021

We are getting more and more request wondering if we could send/receive data via HTTPS to the outside world from within our Hospital Network. As you can imagine our Ensemble/Cache productions are not exposed to the DMZ or has access outside of the network. We only communicate with external vendors through a VPN, so communicating not using a VPN is rather new to us.

Currently there is a project to get rid of using Proxy, and instead of through a Load Balancer that can use rules to filter out traffic, which adds another layer of complexity.

3
0 306
Question Scott Roth · Jan 14, 2021

In the Inbound SQL Adapter settings, is it possible to specify more than 1 field as the Key Field Name? 

Because of the way the Query is being index in Ensemble by the Key Field Name, sometimes transactions get missed and I would like to see if we can add an additional key to the mix to ensure all the transactions are picked up. In this case the InterfaceTrigger is an ID that is auto generated by the table, and I would like to use that as well to ensure we don't miss transactions, and it does not throw any warning messages when it executes the Delete Query.

Thanks

Scott

1
0 359
Question Purushothaman T · Dec 30, 2020

We have a custom FTP Service , and custom FTP adapter . Customization is just to find a duplicate file and for giving specific dynamic file spec pattern.
While running and polling for files, we are getting this error. Could you please help ? What's the issue and how to resolve it ?
ERROR <Ens>ErrFTPListFailed: FTP: Failed List for <FileName> (msg='Cache error in 'readResponse': <READ>zreadResponse+4^%Net.FtpSession.1',code=426)    

1
0 456
Announcement Evgeny Shvarov · Dec 27, 2020

Good day, Developer Community!
 

As you know we have Company listings on Open Exchange. It lets publishing Open Exchange applications on behalf of companies so one can check which solutions in certain industries are being provided by companies.

Sometimes people are also looking for qualitative and proven implementation or consulting services on InterSystems products: IRIS, Caché, Ensemble, or HealthShare.

And recently we introduced a new option on Open Exchange to list the services your company provides related to InterSystems technology: implementation, consulting etc.

How to do that?

Open your company profile in the Services tab and create a service. Choose the type of service and give a description of what the service is about and why it is worth ordering it. Instructions.

Then publish the service by sending it for approval.

Screenshot 2020-09-21 at 16 24 36

0
0 232
Question Mark Sharman · Sep 19, 2019

Hi,

I've a Service utilising the Adapter EnsLib.SQL.InboundAdapter, which uses a Credentials item set with the details of a local SQL account. This currently works, however, we're looking to use the credentials of an AD domain account.

The domain account is a member of an AD security group, which has the required permissions on the source SQL database. I've checked that access is possible with this account via SQL studio.

I've tested setting the Credential username as domain\username and username@FQDN, but neither create a successful connection.

2
0 340
Question Oliver Wilms · Dec 7, 2020

Hello,

I like to know if we need to have the message in a file to process a Record Map?

I am working with Interoperability Production that processes files /messages using Record Maps. My team was asked to redesign the solution for deployment in AWS. We use containers. We had problems with having multiple containers processing files from the same directory. We are considering Amazon Simple Queue Service instead of having files on a shared file system.

Has anybody migrated a Record Map to a Schema Definition to validate a message as a Virtual Document as I have seen with X12 messages?

1
0 286
Question Mary George · Dec 3, 2020

What is the best way to create an HL7 message from JSON input file?

We have JSON file available with data required for building the HL7 message . I am trying to use a standard file/FTP Business service to pick up the file and convert the input %FileCharacterStream into a dynamic Object and use the stand JSON features to read /process the data and build the HL7 message. 

Is there any other better way to do this? or any standard built-in functionality available in HealthShare? 

Thanks you for your help

Mary

2
0 916
Article Oliver Wilms · Nov 16, 2020 2m read

My team is working on redesigning an Interoperability solution that currently runs on a HealthShare server that is part of a mirror. Most of the messages are delimited records processed using Complex Record Mapping. We were told to utilize cloud services available in AWS, use containers, autoscaling…

0
0 323
Question Mikael Toivonen · Oct 12, 2020

I have a file passthrough service that should check for new new files every 10 minutes, process them and then wait again for 10 minutes, even if there are new files waiting in the source directory. The "CallInterval" value feels like a wrong tool for this need since it would keep the service "locked" for a maximun of 10 minutes before releasin resources.  Is there a better way than CallInterval to schedule the service to poll for files every 10 minutes?

2
0 341
Question Mikael Toivonen · Sep 29, 2020

I'm not sure how to go about building this scenario:

  1. I FTP PUT a file "data.txt" to external directory
  2. 3rd party processes that file
  3. 3rd party creates a log file "errors.txt" into the same directory
  4. My integration build should now 
    1. notice that there is a "errors.txt" file
    2. FTP GET that log file, delete it from server and process it 
    3. but we should also delete the "data.txt" from the server as it is "used" and should no longer be there. It is essential that "data.txt" must only be deleted if there is an "errors.txt" file and we have downloaded it
2
0 431
Discussion Neerav Verma · Jul 29, 2020

Hello All,

I have been using IRIS / Ensemble for over a decade and appreciate lot of it's functionalities and features, however besides having a UI of 80's era (which doesn't bother me), what I believe where IRIS is lacking is lack of out of the box connectors (services/operations).
If we look at IRIS's competitors for eg Mulesoft, Talend, Boomi they all have hundreds of pre-built connectors for major applications like Salesforce, SAP etc and cloud services like Azure, AWS etc to store and retrieve information and data.

Just to give an idea here is a link of Dell Boomi connectors

1
0 595
Question Scott Roth · Aug 12, 2020

We have a vendor that every couple of days will just stop transmitting messages, but still hold the TCP/IP connection open. No matter how many times we troubleshoot and talk with them, they don't seem to think its an issue with system.  Normally if I just restart the service it will get the data flowing again.

I know ideal is for them to fix the issue, but in the meantime I have setup an Inactivity time out alert.  I was wondering with the correct filtering if there was a way to say if the Inactivity Alert is triggered during the business day, to have the Alert trigger a restart of the service?

3
0 310
Question Yone Moreno · Jun 24, 2020

Hello,

We wonder how could we send an HL7 message to a service to test it.

For example, we have a service, at localhost port 19111

We have tried to use SoapUI to send a REST POST request as follows:

At the event log we see the following trace:

Then, if we try with POSTMAN as follows:

We observe:

Would it be the only way to test services, pointing a TCP HL7 operation to the service, and send messages using the Test Action?

We mean that we are testing manually sending messages from the operation "ProbarADTs" to "Servicios.TCP.GeneralHospitalADT":

How could we do it from SoapUI or Postman?

3
0 3554
Question Oliver Wilms · Jun 11, 2020

Hello,

I want to deploy Iris Interoperability Production in multiple containers . The production has File Services that process files from EFS location. All the files being processed by multiple containers are in the same directory. The standard Adapter class does not have Check Complete option to lock a file so that other containers File Services looking in the same file path cannot process the same file.

I updated the Inbound File Adapter class to offer another Check Complete option LOCK that will lock the file until it is processed and archived.

2
0 314