GMRCCCRPRE200 ;GOC/PB - PATCH GRMC*3*200 PRE INSTALL ;3/21/18 09:00
;;3.0;CONSULT/REQUEST TRACKING;**200**;Jan 08, 2024;Build 69
;
;SAC EXEMPTION 202311211312-03 : GMRC use of vendor specific code
;ICR 7205
;External reference to ^XOB(18.12 supported by DBIA 7204
;External reference to ^XOB(18.02 supported by DBIA 7205
;External reference to ^XUSRB1 is supported by ICR 2240
;External reference to ^XOBWLIB is supported by ICR 5421
;
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
;S:$G(IEN1802)>0 CHECK=$$GET()
;Q:CHECK=1
;
I $G(IEN1802)'>0 D
.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[HGMRCCCRPRE200 4111 printed Oct 16, 2024@17:46:10 Page 2
GMRCCCRPRE200 ;GOC/PB - PATCH GRMC*3*200 PRE INSTALL ;3/21/18 09:00
+1 ;;3.0;CONSULT/REQUEST TRACKING;**200**;Jan 08, 2024;Build 69
+2 ;
+3 ;SAC EXEMPTION 202311211312-03 : GMRC use of vendor specific code
+4 ;ICR 7205
+5 ;External reference to ^XOB(18.12 supported by DBIA 7204
+6 ;External reference to ^XOB(18.02 supported by DBIA 7205
+7 ;External reference to ^XUSRB1 is supported by ICR 2240
+8 ;External reference to ^XOBWLIB is supported by ICR 5421
+9 ;
+10 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 ;S:$G(IEN1802)>0 CHECK=$$GET()
+17 ;Q:CHECK=1
+18 ;
+19 IF $GET(IEN1802)'>0
Begin DoDot:1
+20 SET SERVADD="127.0.0.1"
+21 SET SERVPORT=80
+22 KILL FDA
+23 ; WEB SERVICE NAME
SET FDA(18.02,"?+1,",.01)="CCRA WEB SERVICE"
+24 ; TYPE
SET FDA(18.02,"?+1,",.02)="REST"
+25 ; CONTEXT ROOT
SET FDA(18.02,"?+1,",200)="csp/healthshare/ccraint/rest/rdc"
+26 ; AVAILABILITY RESOURCE
SET FDA(18.02,"?+1,",201)=""
+27 DO UPDATE^DIE("E","FDA","IENROOT","MSGROOT")
+28 KILL IENROOT,MSGROOT,FDA
+29 ;
+30 ; NAME
SET FDA(18.12,"?+1,",.01)="CCRA WEB SERVER"
+31 ; PORT
SET FDA(18.12,"?+1,",.03)=SERVPORT
+32 ; SERVER
SET FDA(18.12,"?+1,",.04)=SERVADD
+33 ; STATUS 1-ENABLED / 0-DISABLED
SET FDA(18.12,"?+1,",.06)="ENABLED"
+34 ; DEFAULT HTTP TIMEOUT
SET FDA(18.12,"?+1,",.07)=10
+35 DO UPDATE^DIE("E","FDA","IENROOT","MSGROOT")
+36 ;
+37 SET IENROOT1=$GET(IENROOT(1))
SET MULTIEN=0
+38 ;
+39 SET WEBVER=$SELECT(IENROOT1:IENROOT1,1:WEBVER)
+40 KILL IENROOT,MSGROOT,FDA
+41 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
+42 SET MULTIEN=$SELECT(MULTIEN:MULTIEN,1:"+1")
+43 ; WEB SERVICE
SET FDA(18.121,MULTIEN_","_WEBVER_",",.01)="CCRA WEB SERVICE"
+44 ; STATUS 1-ENABLED / 0-DISABLED
SET FDA(18.121,MULTIEN_","_WEBVER_",",.06)="ENABLED"
+45 DO UPDATE^DIE("E","FDA","IENROOT","MSGROOT")
End DoDot:1
+46 ;
+47 DO BMES^XPDUTL("Connecting to CCRA WEB SERVICE..")
+48 SET WSTAT=$$GET
+49 IF '$GET(WSTAT)
Begin DoDot:1
+50 DO BMES^XPDUTL(" *********************************************************")
+51 DO BMES^XPDUTL(" WARNING: The WEB SERVER/SERVICE SETUP FAILED")
+52 DO BMES^XPDUTL(" Please try again after a few minutes. Failed to install,")
+53 DO BMES^XPDUTL(" please submit a Service Now ticket.")
+54 DO BMES^XPDUTL(" >>>> Installation aborted <<<<")
+55 DO BMES^XPDUTL(" *********************************************************")
+56 ;S XPDQUIT=1 ; Do not install this transport global and KILL it from ^XTMP.
End DoDot:1
QUIT
+57 ;
+58 DO BMES^XPDUTL(" *******************************************************")
+59 DO BMES^XPDUTL(" The Environmental Check Routine finished Successfully.")
+60 DO BMES^XPDUTL(" *******************************************************")
+61 QUIT
+62 ;
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 ;