XWBVLC ;OIFO-Oakland/REM - M2M Broker Client ;05/17/2002 17:47
;;1.1;RPC BROKER;**28**;Mar 28, 1997
;QUIT
;
EXECUTE(XWBPARMS) ; -- Main entry point
NEW X,XWBI,XWBOK,XWBRES,XWBREF,XWBROOT,XWBREQ,XWBREAD,XWBTO,XWBFIRST,XWBSTOP
NEW $ETRAP,$ESTACK S $ETRAP="D SYSERR^XWBVLL"
;
; -- if no 'results' node set, set it and kill it!
IF $G(XWBPARMS("RESULTS"))="" SET XWBPARMS("RESULTS")=$NA(^TMP("XWBM2MVLC",$J,"XML"))
SET XWBROOT=XWBPARMS("RESULTS")
KILL @XWBROOT
;
SET XWBREQ=XWBPARMS("REQUEST")
;
SET XWBRES=0
;
; -- check for socket information **M2M - use later for error chk
;IF '$D(XWBPARMS("ADDRESS")) D CLIERR(1,.XWBROOT) GOTO MAINQ
;IF '$D(XWBPARMS("PORT")) D CLIERR(2,.XWBROOT) GOTO MAINQ
; Retry open 3 times
;SET XWBPARMS("RETRIES")=3
;
;IF '$$OPEN^XWBRL(.XWBPARMS) D CLIERR(3,.XWBROOT) GOTO MAINQ ;can pull out after it works with M2M **REM
;
; -- write request
DO PRE^XWBRL
SET XWBI=0 FOR SET XWBI=$O(@XWBREQ@(XWBI)) Q:'XWBI DO WRITE^XWBRL(@XWBREQ@(XWBI))
;
;IF $G(XWBDBUG) S X=$G(XWBPARMS("URI")) M ^TMP("XWBM2MCL",X)=XWBPARMS
;
; -- send eot and flush buffer
DO POST^XWBRL
;
SET XWBREAD=20,XWBTO=1,XWBFIRST=0,XWBSTOP=0
;
; -- set parameters for RawLink
SET XWBRL("TIME OUT")=1
SET XWBRL("READ CHARACTERS")=20
SET XWBRL("FIRST READ")=0
SET XWBRL("STORE")=XWBROOT
SET XWBRL("STOP FLAG")=0
;
; -- read results
SET XWBOK=$$READ^XWBRL(XWBROOT,.XWBREAD,.XWBTO,.XWBFIRST,.XWBSTOP)
;
;-------------------------------------------------------
; -- close port - - delete after close works **REM
;IF $G(XWBPARMS("MODE"))'="RPCBroker" D CLOSE^XWBRL
;
;D CLOSE^XWBRL ;Comment out for M2M
;---------------------------------------------------------------
;
; -- app processes data (0 = success) ; I think 0 = failure **REM
SET XWBRES=1
;
MAINQ ;
QUIT XWBRES
;
; ----------------------------------------------------------------------------------
; Client Error Handler
; ----------------------------------------------------------------------------------
CLIERR(XWBCODE,XWBROOT) ; -- send client error message
NEW XWBDAT
SET XWBDAT("MESSAGE TYPE")="Gov.VA.Med.Foundations.Errors"
SET XWBDAT("ERRORS",1,"CODE")=1
SET XWBDAT("ERRORS",1,"ERROR TYPE")="client"
SET XWBDAT("ERRORS",1,"CDATA")=1
SET XWBDAT("ERRORS",1,"MESSAGE",1)=$P($TEXT(CLIERRS+XWBCODE),";;",2)
DO BUILD^XWBUTL(.XWBROOT,.XWBDAT)
QUIT
;
CLIERRS ; -- VistALink client errors
;;'Address' parameter not specified.
;;'Port' parameter not specified.
;;"Not able to open port"
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HXWBVLC 2608 printed Oct 16, 2024@18:38:13 Page 2
XWBVLC ;OIFO-Oakland/REM - M2M Broker Client ;05/17/2002 17:47
+1 ;;1.1;RPC BROKER;**28**;Mar 28, 1997
+2 ;QUIT
+3 ;
EXECUTE(XWBPARMS) ; -- Main entry point
+1 NEW X,XWBI,XWBOK,XWBRES,XWBREF,XWBROOT,XWBREQ,XWBREAD,XWBTO,XWBFIRST,XWBSTOP
+2 NEW $ETRAP,$ESTACK
SET $ETRAP="D SYSERR^XWBVLL"
+3 ;
+4 ; -- if no 'results' node set, set it and kill it!
+5 IF $GET(XWBPARMS("RESULTS"))=""
SET XWBPARMS("RESULTS")=$NAME(^TMP("XWBM2MVLC",$JOB,"XML"))
+6 SET XWBROOT=XWBPARMS("RESULTS")
+7 KILL @XWBROOT
+8 ;
+9 SET XWBREQ=XWBPARMS("REQUEST")
+10 ;
+11 SET XWBRES=0
+12 ;
+13 ; -- check for socket information **M2M - use later for error chk
+14 ;IF '$D(XWBPARMS("ADDRESS")) D CLIERR(1,.XWBROOT) GOTO MAINQ
+15 ;IF '$D(XWBPARMS("PORT")) D CLIERR(2,.XWBROOT) GOTO MAINQ
+16 ; Retry open 3 times
+17 ;SET XWBPARMS("RETRIES")=3
+18 ;
+19 ;IF '$$OPEN^XWBRL(.XWBPARMS) D CLIERR(3,.XWBROOT) GOTO MAINQ ;can pull out after it works with M2M **REM
+20 ;
+21 ; -- write request
+22 DO PRE^XWBRL
+23 SET XWBI=0
FOR
SET XWBI=$ORDER(@XWBREQ@(XWBI))
if 'XWBI
QUIT
DO WRITE^XWBRL(@XWBREQ@(XWBI))
+24 ;
+25 ;IF $G(XWBDBUG) S X=$G(XWBPARMS("URI")) M ^TMP("XWBM2MCL",X)=XWBPARMS
+26 ;
+27 ; -- send eot and flush buffer
+28 DO POST^XWBRL
+29 ;
+30 SET XWBREAD=20
SET XWBTO=1
SET XWBFIRST=0
SET XWBSTOP=0
+31 ;
+32 ; -- set parameters for RawLink
+33 SET XWBRL("TIME OUT")=1
+34 SET XWBRL("READ CHARACTERS")=20
+35 SET XWBRL("FIRST READ")=0
+36 SET XWBRL("STORE")=XWBROOT
+37 SET XWBRL("STOP FLAG")=0
+38 ;
+39 ; -- read results
+40 SET XWBOK=$$READ^XWBRL(XWBROOT,.XWBREAD,.XWBTO,.XWBFIRST,.XWBSTOP)
+41 ;
+42 ;-------------------------------------------------------
+43 ; -- close port - - delete after close works **REM
+44 ;IF $G(XWBPARMS("MODE"))'="RPCBroker" D CLOSE^XWBRL
+45 ;
+46 ;D CLOSE^XWBRL ;Comment out for M2M
+47 ;---------------------------------------------------------------
+48 ;
+49 ; -- app processes data (0 = success) ; I think 0 = failure **REM
+50 SET XWBRES=1
+51 ;
MAINQ ;
+1 QUIT XWBRES
+2 ;
+3 ; ----------------------------------------------------------------------------------
+4 ; Client Error Handler
+5 ; ----------------------------------------------------------------------------------
CLIERR(XWBCODE,XWBROOT) ; -- send client error message
+1 NEW XWBDAT
+2 SET XWBDAT("MESSAGE TYPE")="Gov.VA.Med.Foundations.Errors"
+3 SET XWBDAT("ERRORS",1,"CODE")=1
+4 SET XWBDAT("ERRORS",1,"ERROR TYPE")="client"
+5 SET XWBDAT("ERRORS",1,"CDATA")=1
+6 SET XWBDAT("ERRORS",1,"MESSAGE",1)=$PIECE($TEXT(CLIERRS+XWBCODE),";;",2)
+7 DO BUILD^XWBUTL(.XWBROOT,.XWBDAT)
+8 QUIT
+9 ;
CLIERRS ; -- VistALink client errors
+1 ;;'Address' parameter not specified.
+2 ;;'Port' parameter not specified.
+3 ;;"Not able to open port"