Question
· Aug 26

Send a request from a class to a different server business service

I have this code and I need to send 

Set tRequest= ##class(Testing.Messages.GatewayCreateFacilityRequest).%New()

Set tRequest.facilityCode ="VINUSE"

 Set tResponse = ##class(Testing.Messages.GatewayCreateFacilityResponse).%New()

need to send a request to a new server:

Server: ECR10 

Namespace: ECR

Business Service: Healthix.Common.Verato.Gateway.Service.HubQueryService

set tResponse = ##class(Testing.Gateway.Service.HubQueryService).%New().CreateFacility(tRequest)

How do I add code to send it to the ECR10 server?

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

Assuming this is code that runs outside of a Production and is trying to invoke a Business Service that does run within a Production in the same Namespace, the approach would be generally like this:

1) Create an instance of the Business Service:

    set tSC = ##class(Ens.Director).CreateBusinessService(tServiceName, .tServiceInstance)

2) Invoke the Business Service:

        set tSC = tServiceInstance.ProcessInput(tRequest, .tResponse)

This technique is used for SOAP services, REST APIs, and Tasks that invoke functionality provided by a Production.