[613] | 1 | XWBVL ;OIFO-Oakland/REM - M2M Broker Server Link Utl ;05/17/2002 17:46
|
---|
| 2 | ;;1.1;RPC BROKER;**28**;Mar 28, 1997
|
---|
| 3 | ;
|
---|
| 4 | QUIT
|
---|
| 5 | ;
|
---|
| 6 | START(PORT) ; -- start listener
|
---|
| 7 | ; // TODO: Add checks and structure to not start listener if already active on port
|
---|
| 8 | DO START^XWBVLL(PORT)
|
---|
| 9 | QUIT
|
---|
| 10 | ;
|
---|
| 11 | ; ---------------------------------------------------------------------
|
---|
| 12 | ; Close Socket: Methods Calls
|
---|
| 13 | ; ---------------------------------------------------------------------
|
---|
| 14 | ;
|
---|
| 15 | EXECUTE(XWBPARMS) ; -- execute rpc call
|
---|
| 16 | NEW STATUS
|
---|
| 17 | IF $G(XWBPARMS("RESULTS"))="" SET XWBPARMS("RESULTS")=$NA(^TMP("XWB CLOSE SOCKET",$J,"XML"))
|
---|
| 18 | SET STATUS=$$EXECUTE^XWBVLC(.XWBPARMS)
|
---|
| 19 | QUIT STATUS
|
---|
| 20 | ;
|
---|
| 21 | REQUEST(XWBPARMS) ; -- build xml request
|
---|
| 22 | NEW XWBLINE
|
---|
| 23 | SET XWBLINE=0
|
---|
| 24 | SET XWBPARMS("MESSAGE TYPE")="Gov.VA.Med.Foundations.CloseSocketRequest"
|
---|
| 25 | IF $G(XWBPARMS("REQUEST"))="" SET XWBPARMS("REQUEST")=$NA(XWBPARMS("REQUEST","XML"))
|
---|
| 26 | SET XWBREQ=XWBPARMS("REQUEST")
|
---|
| 27 | KILL @XWBREQ
|
---|
| 28 | ;
|
---|
| 29 | ; -- build request
|
---|
| 30 | DO ADD($$XMLHDR^XWBUTL())
|
---|
| 31 | DO ADD("<vistalink type="""_$G(XWBPARMS("MESSAGE TYPE"))_"""/>")
|
---|
| 32 | QUIT
|
---|
| 33 | ;
|
---|
| 34 | ADD(STR) ; -- add string to array
|
---|
| 35 | SET XWBLINE=XWBLINE+1
|
---|
| 36 | SET @XWBREQ@(XWBLINE)=STR
|
---|
| 37 | QUIT
|
---|
| 38 | ;
|
---|
| 39 | RESPONSE() ; -- build xml response
|
---|
| 40 | ; -- initialize
|
---|
| 41 | DO PRE^XWBRL
|
---|
| 42 | DO WRITE^XWBRL($$XMLHDR^XWBUTL())
|
---|
| 43 | DO WRITE^XWBRL("<vistalink type=""Gov.VA.Med.Foundations.CloseSocketResponse"">")
|
---|
| 44 | DO WRITE^XWBRL("<results success=""1"" />")
|
---|
| 45 | DO WRITE^XWBRL("</vistalink>")
|
---|
| 46 | ; -- send eot and flush buffer
|
---|
| 47 | DO POST^XWBRL
|
---|
| 48 | QUIT
|
---|
| 49 | ;
|
---|
| 50 | ; ---------------------------------------------------------------------
|
---|
| 51 | ; Parse Results of Successful RPC Request
|
---|
| 52 | ; ---------------------------------------------------------------------
|
---|
| 53 | ;
|
---|
| 54 | PARSE(XWBPARMS,XWBY) ; -- parse legacy rpc results ; uses DOM parser
|
---|
| 55 | NEW XWBDOM
|
---|
| 56 | SET XWBDOM=$$EN^MXMLDOM(XWBPARMS("RESULTS"),"")
|
---|
| 57 | SET @XWBY=$$VALUE^MXMLDOM(XWBDOM,2,"success")
|
---|
| 58 | DO DELETE^MXMLDOM(XWBDOM)
|
---|
| 59 | QUIT
|
---|
| 60 | ;
|
---|