TIUCCRPRE363 ;COG/PB - PATCH TIU*1.0*363 PRE INSTALL ; 11/08/23 14:30
;;1.0;TEXT INTEGRATION UTILITIES;**363**;Nov 08, 2023;Build 69
;
;SAC EXEMPTION 202311211320-04 : TIU use of vendor specific code
;ICR 7205
;
Q
EN ;
N FDA ; -- FileMan Data Array
N WEBVICE ; -- Web Service Internal Entry Number
N WEBVER ; -- Web Server Internal Entry Number
N MULTIEN ; -- Web Service Multiple Internal Entry Number
N WSTAT ; -- Web Service Status
N IENROOT,MSGROOT,IENROOT1,VICEIEN
;
N DIR,DTOUT,DUOUT,DIRUT,DIROUT,SERVADD,X,Y,ENVRMT,SERVPORT,IEN1802
; Check to see if the web service has already been installed and configured
S IEN1802=$O(^XOB(18.02,"B","CCRA WEB SERVICE",""))
I IEN1802>0 D
. D BMES^XPDUTL("*************************************************************")
. D BMES^XPDUTL(" The CCRA WEB SERVICE has already been setup and configured. ")
. D BMES^XPDUTL("*************************************************************")
;. S XPDQUIT=1 ; Do not install this transport global and KILL it from ^XTMP
Q:$G(IEN1802)>0
;
S SERVADD="127.0.0.1"
S SERVPORT=80
K FDA
S FDA(18.02,"?+1,",.01)="CCRA WEB SERVICE" ; WEB SERVICE NAME
S FDA(18.02,"?+1,",.02)="REST" ; TYPE
S FDA(18.02,"?+1,",200)="csp/healthshare/ccraint/rest/rdc" ; CONTEXT ROOT
S FDA(18.02,"?+1,",201)="" ; AVAILABILITY RESOURCE
D UPDATE^DIE("E","FDA","IENROOT","MSGROOT")
K IENROOT,MSGROOT,FDA
;
S FDA(18.12,"?+1,",.01)="CCRA WEB SERVER" ; NAME
S FDA(18.12,"?+1,",.03)=SERVPORT ; PORT
S FDA(18.12,"?+1,",.04)=SERVADD ; SERVER
S FDA(18.12,"?+1,",.06)="ENABLED" ; STATUS 1-ENABLED / 0-DISABLED
S FDA(18.12,"?+1,",.07)=10 ; DEFAULT HTTP TIMEOUT
D UPDATE^DIE("E","FDA","IENROOT","MSGROOT")
;
S IENROOT1=$G(IENROOT(1)),MULTIEN=0
;
S WEBVER=$S(IENROOT1:IENROOT1,1:WEBVER)
K IENROOT,MSGROOT,FDA
S VICEIEN=0 F S VICEIEN=$O(^XOB(18.12,WEBVER,100,"B",VICEIEN)) Q:'VICEIEN I $$GET1^DIQ(18.02,VICEIEN,.01)="CCRA WEB SERVICE" S MULTIEN=VICEIEN Q
S MULTIEN=$S(MULTIEN:MULTIEN,1:"+1")
S FDA(18.121,MULTIEN_","_WEBVER_",",.01)="CCRA WEB SERVICE" ; WEB SERVICE
S FDA(18.121,MULTIEN_","_WEBVER_",",.06)="ENABLED" ; STATUS 1-ENABLED / 0-DISABLED
D UPDATE^DIE("E","FDA","IENROOT","MSGROOT")
;
D BMES^XPDUTL("Connecting to CCRA WEB SERVICE..")
S WSTAT=$$GET
I '$G(WSTAT) D Q
. D BMES^XPDUTL(" *********************************************************")
. D BMES^XPDUTL(" WARNING: The WEB SERVER/SERVICE SETUP FAILED")
. D BMES^XPDUTL(" Please try again after a few minutes. Failed to install,")
. D BMES^XPDUTL(" please submit a Service Now ticket.")
. D BMES^XPDUTL(" >>>> Installation aborted <<<<")
. D BMES^XPDUTL(" *********************************************************")
. S XPDQUIT=1 ; Do not install this transport global and KILL it from ^XTMP.
;
D BMES^XPDUTL(" *******************************************************")
D BMES^XPDUTL(" The Environmental Check Routine finished Successfully.")
D BMES^XPDUTL(" *******************************************************")
Q
;
GET() ; -- Send a test to the Web Service and compare the Result
N SERVER,SERVICE,RESOURCE,REQUEST,SC,RESPONSE,RESPJSON,DATA,CCRAERR
S SERVER="CCRA WEB SERVER"
S SERVICE="CCRA WEB SERVICE"
S RESOURCE=""
;
; Get an instance of the REST request object.
S REQUEST=$$GETREST^XOBWLIB(SERVICE,SERVER)
;
; Execute the HTTP Get method.
S SC=$$GET^XOBWLIB(REQUEST,RESOURCE,.CCRAERR,0)
I 'SC I CCRAERR.code=404 Q 1
I 'SC Q "0^General Service Error"
;
; Process the response.
S RESPONSE=REQUEST.HttpResponse
S DATA=RESPONSE.Data
S RESPJSON=""
F Q:DATA.AtEnd Set RESPJSON=RESPJSON_DATA.ReadLine()
I $L($G(RESPJSON)) Q 1
Q 0
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HTIUCCRPRE363 3803 printed Dec 13, 2024@02:39:15 Page 2
TIUCCRPRE363 ;COG/PB - PATCH TIU*1.0*363 PRE INSTALL ; 11/08/23 14:30
+1 ;;1.0;TEXT INTEGRATION UTILITIES;**363**;Nov 08, 2023;Build 69
+2 ;
+3 ;SAC EXEMPTION 202311211320-04 : TIU use of vendor specific code
+4 ;ICR 7205
+5 ;
+6 QUIT
EN ;
+1 ; -- FileMan Data Array
NEW FDA
+2 ; -- Web Service Internal Entry Number
NEW WEBVICE
+3 ; -- Web Server Internal Entry Number
NEW WEBVER
+4 ; -- Web Service Multiple Internal Entry Number
NEW MULTIEN
+5 ; -- Web Service Status
NEW WSTAT
+6 NEW IENROOT,MSGROOT,IENROOT1,VICEIEN
+7 ;
+8 NEW DIR,DTOUT,DUOUT,DIRUT,DIROUT,SERVADD,X,Y,ENVRMT,SERVPORT,IEN1802
+9 ; Check to see if the web service has already been installed and configured
+10 SET IEN1802=$ORDER(^XOB(18.02,"B","CCRA WEB SERVICE",""))
+11 IF IEN1802>0
Begin DoDot:1
+12 DO BMES^XPDUTL("*************************************************************")
+13 DO BMES^XPDUTL(" The CCRA WEB SERVICE has already been setup and configured. ")
+14 DO BMES^XPDUTL("*************************************************************")
End DoDot:1
+15 ;. S XPDQUIT=1 ; Do not install this transport global and KILL it from ^XTMP
+16 if $GET(IEN1802)>0
QUIT
+17 ;
+18 SET SERVADD="127.0.0.1"
+19 SET SERVPORT=80
+20 KILL FDA
+21 ; WEB SERVICE NAME
SET FDA(18.02,"?+1,",.01)="CCRA WEB SERVICE"
+22 ; TYPE
SET FDA(18.02,"?+1,",.02)="REST"
+23 ; CONTEXT ROOT
SET FDA(18.02,"?+1,",200)="csp/healthshare/ccraint/rest/rdc"
+24 ; AVAILABILITY RESOURCE
SET FDA(18.02,"?+1,",201)=""
+25 DO UPDATE^DIE("E","FDA","IENROOT","MSGROOT")
+26 KILL IENROOT,MSGROOT,FDA
+27 ;
+28 ; NAME
SET FDA(18.12,"?+1,",.01)="CCRA WEB SERVER"
+29 ; PORT
SET FDA(18.12,"?+1,",.03)=SERVPORT
+30 ; SERVER
SET FDA(18.12,"?+1,",.04)=SERVADD
+31 ; STATUS 1-ENABLED / 0-DISABLED
SET FDA(18.12,"?+1,",.06)="ENABLED"
+32 ; DEFAULT HTTP TIMEOUT
SET FDA(18.12,"?+1,",.07)=10
+33 DO UPDATE^DIE("E","FDA","IENROOT","MSGROOT")
+34 ;
+35 SET IENROOT1=$GET(IENROOT(1))
SET MULTIEN=0
+36 ;
+37 SET WEBVER=$SELECT(IENROOT1:IENROOT1,1:WEBVER)
+38 KILL IENROOT,MSGROOT,FDA
+39 SET VICEIEN=0
FOR
SET VICEIEN=$ORDER(^XOB(18.12,WEBVER,100,"B",VICEIEN))
if 'VICEIEN
QUIT
IF $$GET1^DIQ(18.02,VICEIEN,.01)="CCRA WEB SERVICE"
SET MULTIEN=VICEIEN
QUIT
+40 SET MULTIEN=$SELECT(MULTIEN:MULTIEN,1:"+1")
+41 ; WEB SERVICE
SET FDA(18.121,MULTIEN_","_WEBVER_",",.01)="CCRA WEB SERVICE"
+42 ; STATUS 1-ENABLED / 0-DISABLED
SET FDA(18.121,MULTIEN_","_WEBVER_",",.06)="ENABLED"
+43 DO UPDATE^DIE("E","FDA","IENROOT","MSGROOT")
+44 ;
+45 DO BMES^XPDUTL("Connecting to CCRA WEB SERVICE..")
+46 SET WSTAT=$$GET
+47 IF '$GET(WSTAT)
Begin DoDot:1
+48 DO BMES^XPDUTL(" *********************************************************")
+49 DO BMES^XPDUTL(" WARNING: The WEB SERVER/SERVICE SETUP FAILED")
+50 DO BMES^XPDUTL(" Please try again after a few minutes. Failed to install,")
+51 DO BMES^XPDUTL(" please submit a Service Now ticket.")
+52 DO BMES^XPDUTL(" >>>> Installation aborted <<<<")
+53 DO BMES^XPDUTL(" *********************************************************")
+54 ; Do not install this transport global and KILL it from ^XTMP.
SET XPDQUIT=1
End DoDot:1
QUIT
+55 ;
+56 DO BMES^XPDUTL(" *******************************************************")
+57 DO BMES^XPDUTL(" The Environmental Check Routine finished Successfully.")
+58 DO BMES^XPDUTL(" *******************************************************")
+59 QUIT
+60 ;
GET() ; -- Send a test to the Web Service and compare the Result
+1 NEW SERVER,SERVICE,RESOURCE,REQUEST,SC,RESPONSE,RESPJSON,DATA,CCRAERR
+2 SET SERVER="CCRA WEB SERVER"
+3 SET SERVICE="CCRA WEB SERVICE"
+4 SET RESOURCE=""
+5 ;
+6 ; Get an instance of the REST request object.
+7 SET REQUEST=$$GETREST^XOBWLIB(SERVICE,SERVER)
+8 ;
+9 ; Execute the HTTP Get method.
+10 SET SC=$$GET^XOBWLIB(REQUEST,RESOURCE,.CCRAERR,0)
+11 IF 'SC
IF CCRAERR.code=404
QUIT 1
+12 IF 'SC
QUIT "0^General Service Error"
+13 ;
+14 ; Process the response.
+15 SET RESPONSE=REQUEST.HttpResponse
+16 SET DATA=RESPONSE.Data
+17 SET RESPJSON=""
+18 FOR
if DATA.AtEnd
QUIT
SET RESPJSON=RESPJSON_DATA.ReadLine()
+19 IF $LENGTH($GET(RESPJSON))
QUIT 1
+20 QUIT 0
+21 ;