Question Enrico Parisi · Dec 19, 2022

HealthShare Edge Gateway method EPRSave()

Is anybody using the EPRSave() Edge Gateway method/API?

It is documented in:

https://docs.intersystems.com/hs20222/csp/docbook/DocBook.UI.Page.cls?K…

Enrico

Product version: IRIS 2022.1

Comments

Yuri Marx · Dec 20, 2022

Yes, because the Edge is usually remote, so I used but calling the remote Web Service:

1. Create the web service client from the WSDL http://<IP>:<PORT>/<NAMESPACE>/csp/healthshare/hsedge/HS.Gateway.HSWS.WebServices.cls?wsdl. (more details: https://docs.intersystems.com/hs20221/csp/docbook/DocBook.UI.Page.cls?K…)

1.1 To create the web service client classes do (https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cl…):

set r=##class(%SOAP.WSDL.Reader).%New() 
GSOAP>set url="http://<IP>:<PORT>/<NAMESPACE>/csp/healthshare/hsedge/HS.Gateway.HSWS.WebServices.cls?wsdl"
 
GSOAP>d r.Process(url, "targetpackagename")

2. Use the SOAP generated class to consume EPRSave():

Class package.NameOperation Extends Ens.BusinessOperation
{

Parameter ADAPTER = "EnsLib.SOAP.OutboundAdapter";Parameter INVOCATION = "Queue";
Method SendSDA(pRequest As pack.WSReq, Output pResponse As pack.Resp) As%Status
{
  
  Set tSC = 1Set sda = ""Set pResponse = ##class(pack.Resp).%New() 

  Try {
    
    While 'pRequest.sda.AtEnd {
      Set sda = sda_pRequest.sda.ReadLine() 
    }
    
    Set request = ##class(hcd.ECRUpdateRequest).%New()
    Set request.UpdateECRDemographics = 1Set request.AllowFacilityAsAssigningAuthority = 0Set request.StreamContentType = "SDA3"Set request.ContentStream = sda
    Set client = ##class(hcd.HS.Gateway.HSWS.WebServicesSoap).%New()
    Do##class(Ens.Util.Log).LogInfo($classname(),"SendSDA","Send SDA to: "_client.Location)
    Set client.SSLConfiguration = "HCD_SSL"Set cred = ##class(Ens.Config.Credentials).%OpenId("HS_Services")
    Set wsuser = cred.Username
    Set wspass = cred.Password  
    Do client.WSSecurityLogin(wsuser,wspass) 
    Do client.EPRSave(request, .response)
    Set pResponse.response = "OK"Set pResponse.response = "SDA sent"
  } Catch ex {
    Set tSC = 1Do##class(Ens.Util.Log).LogError($classname(),"SendSDA",$System.Status.GetErrorText(%objlasterror))
    Set pResponse.response = "Not OK"Set pResponse.response = "Error while sending SDA. Details: "_$System.Status.GetErrorText(%objlasterror)
    Set..SuspendMessage = 1
  }

  Return tSC
}

XData MessageMap
{
<MapItems>
  <MapItem MessageType="pack.WSReq">
    <Method>SendSDA</Method>
  </MapItem>
</MapItems>
}

}
0
Enrico Parisi  Dec 20, 2022 to Yuri Marx

Hi Yuri, thank you for your sample, I noticed you don't handle/consider the response from EPRSave().

Are you actually using that API in a production system?

0
Yuri Marx  Dec 20, 2022 to Enrico Parisi

The response is a string code only, so if we don't have error, the edge was sucessful, otherwise I try to suspend to try again after

0
Enrico Parisi  Dec 21, 2022 to Yuri Marx

In your sample the response from EPRSave() is never used/tested.

Do client.EPRSave(request, .response)

Are you actually using that API in a production system?

0