source: FOIAVistA/trunk/r/RPC_BROKER-XWB/XWBVLC.m@ 1353

Last change on this file since 1353 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 2.5 KB
Line 
1XWBVLC ;OIFO-Oakland/REM - M2M Broker Client ;05/17/2002 17:47
2 ;;1.1;RPC BROKER;**28**;Mar 28, 1997
3 ;QUIT
4 ;
5EXECUTE(XWBPARMS) ; -- Main entry point
6 NEW X,XWBI,XWBOK,XWBRES,XWBREF,XWBROOT,XWBREQ,XWBREAD,XWBTO,XWBFIRST,XWBSTOP
7 NEW $ETRAP,$ESTACK S $ETRAP="D SYSERR^XWBVLL"
8 ;
9 ; -- if no 'results' node set, set it and kill it!
10 IF $G(XWBPARMS("RESULTS"))="" SET XWBPARMS("RESULTS")=$NA(^TMP("XWBM2MVLC",$J,"XML"))
11 SET XWBROOT=XWBPARMS("RESULTS")
12 KILL @XWBROOT
13 ;
14 SET XWBREQ=XWBPARMS("REQUEST")
15 ;
16 SET XWBRES=0
17 ;
18 ; -- check for socket information **M2M - use later for error chk
19 ;IF '$D(XWBPARMS("ADDRESS")) D CLIERR(1,.XWBROOT) GOTO MAINQ
20 ;IF '$D(XWBPARMS("PORT")) D CLIERR(2,.XWBROOT) GOTO MAINQ
21 ; Retry open 3 times
22 ;SET XWBPARMS("RETRIES")=3
23 ;
24 ;IF '$$OPEN^XWBRL(.XWBPARMS) D CLIERR(3,.XWBROOT) GOTO MAINQ ;can pull out after it works with M2M **REM
25 ;
26 ; -- write request
27 DO PRE^XWBRL
28 SET XWBI=0 FOR SET XWBI=$O(@XWBREQ@(XWBI)) Q:'XWBI DO WRITE^XWBRL(@XWBREQ@(XWBI))
29 ;
30 ;IF $G(XWBDBUG) S X=$G(XWBPARMS("URI")) M ^TMP("XWBM2MCL",X)=XWBPARMS
31 ;
32 ; -- send eot and flush buffer
33 DO POST^XWBRL
34 ;
35 SET XWBREAD=20,XWBTO=1,XWBFIRST=0,XWBSTOP=0
36 ;
37 ; -- set parameters for RawLink
38 SET XWBRL("TIME OUT")=1
39 SET XWBRL("READ CHARACTERS")=20
40 SET XWBRL("FIRST READ")=0
41 SET XWBRL("STORE")=XWBROOT
42 SET XWBRL("STOP FLAG")=0
43 ;
44 ; -- read results
45 SET XWBOK=$$READ^XWBRL(XWBROOT,.XWBREAD,.XWBTO,.XWBFIRST,.XWBSTOP)
46 ;
47 ;-------------------------------------------------------
48 ; -- close port - - delete after close works **REM
49 ;IF $G(XWBPARMS("MODE"))'="RPCBroker" D CLOSE^XWBRL
50 ;
51 ;D CLOSE^XWBRL ;Comment out for M2M
52 ;---------------------------------------------------------------
53 ;
54 ; -- app processes data (0 = success) ; I think 0 = failure **REM
55 SET XWBRES=1
56 ;
57MAINQ ;
58 QUIT XWBRES
59 ;
60 ; ----------------------------------------------------------------------------------
61 ; Client Error Handler
62 ; ----------------------------------------------------------------------------------
63CLIERR(XWBCODE,XWBROOT) ; -- send client error message
64 NEW XWBDAT
65 SET XWBDAT("MESSAGE TYPE")="Gov.VA.Med.Foundations.Errors"
66 SET XWBDAT("ERRORS",1,"CODE")=1
67 SET XWBDAT("ERRORS",1,"ERROR TYPE")="client"
68 SET XWBDAT("ERRORS",1,"CDATA")=1
69 SET XWBDAT("ERRORS",1,"MESSAGE",1)=$P($TEXT(CLIERRS+XWBCODE),";;",2)
70 DO BUILD^XWBUTL(.XWBROOT,.XWBDAT)
71 QUIT
72 ;
73CLIERRS ; -- VistALink client errors
74 ;;'Address' parameter not specified.
75 ;;'Port' parameter not specified.
76 ;;"Not able to open port"
Note: See TracBrowser for help on using the repository browser.