Question
· Jun 18

Looking for examples of creating RESTful JSON web service as "Business service" and converting the JSON data received to a HL-7 message in a Transformation.

HI,

I'm migration an existing integration to InterSystems.  The upstream (external) system calls a JSON web service hosted in the interface engine, which converts the JSON data received to a HL-7 messages to send to the downstream system. I'm looking for direction and example of how to do the equivalent in InterSystems, so the the upstream system only has to modify the URL of the web service they call.

I suppose in IS we'll need to create a business service that is a RESTful JSON web service? How to access the JSON data (parameters in the web service call) in the Transformation?

Thank you!

W

Product version: IRIS 2024.1
Discussion (2)1
Log in or sign up to continue

Thanks Phil. Can you provide more detail on how to create a business service with the EnsLib.HTTP.InboundAdapter to receive the JSON message on a REST end point? Would it allow external systems to post to with JSON data via http potocol (i.e. with header 'Content-Type: application/json')?

That would be the first step. I will worry about putting the JSON data in a message structure and passing it to and using it in the business process next.

Updated (jul 4th):

I followed the documentation on EnsLib.HTTP.InboundAdapter and created a business service, and a request message class.  So how do I go about testing it after instantiate this business service? What is would be the URL I post to? What other configuration do I have to do?

Class DEVTEST01PKG.HL7ProductionTest01.MyNewWebService Extends EnsLib.HTTP.Service

{

Parameter ADAPTER = "EnsLib.HTTP.InboundAdapter";

Method OnProcessInput(pInput As %GlobalCharacterStream, pOutput As %RegisteredObject) As %Status

{

set tsc=$$$OK

Set tData=pInput.Read(,.tSC)

If $$$ISERR(tSC)

{

do $System.Status.DisplayError(tSC)

}

//create request object to send

Set tRequest=##class(DEVTEST01PKG.HL7ProductionTest01.MyTestRequestMsg).%New()

//use a delimiter to separate the form variables

Set list=$LISTFROMSTRING(tData,"&")

//examine each element and extract the relevant data

Set ptr=0

While $LISTNEXT(list,ptr,key) {

If $PIECE(key,"=") = "MRN" {

Set tRequest.MRN = $PIECE(key,"=",2)

}

Elseif $PIECE(key,"=") = "name" {

SET tRequest.name = $PIECE(key,"=",2)

}

Elseif $PIECE(key,"=") = "NoteID" {

Set tRequest.NoteID = $PIECE(key,"=",2)

}

}

//send to lookup process

Set tSC=..SendRequestSync("EHTTP.LookupProcess",tRequest,.tResponse)

//define output for OnProcessInput

Set pOutput=tResponse

Quit tSC

}

Method OnInit() As %Status

{

Set ..Adapter.ParseBodyFormVars=1

Quit 1

}

}

W