source: cprs/branches/tmg-cprs/m_files/TMGRPC2.m@ 1531

Last change on this file since 1531 was 796, checked in by Kevin Toppenberg, 14 years ago

Initial upload

File size: 4.0 KB
Line 
1TMGRPC1 ;TMG/kst/RPC Functions for Install transfer ;01/07/08
2 ;;1.0;TMG-LIB;**1**;01/07/08
3
4 ;"TMG RPC FUNCTIONS for transferring files from an OLD installation
5 ;" to a NEW installation.
6
7 ;"Kevin Toppenberg MD
8 ;"GNU General Public License (GPL) applies
9 ;"3/24/07
10
11 ;"=======================================================================
12 ;" RPC -- Public Functions.
13 ;"=======================================================================
14
15 ;"=======================================================================
16 ;"PRIVATE API FUNCTIONS
17 ;"=======================================================================
18
19
20 ;"=======================================================================
21 ;"=======================================================================
22 ;"Dependencies:
23
24
25 ;"=======================================================================
26 ;"=======================================================================
27
28
29Connect()
30 ;"Purpose: To establish M-2-M connection, from the OLD installation
31 ;" into the NEW installation.
32 ;"Input: None (for now)
33 ;"Results: 1 if connected, 0 if NOT connected
34
35 new connected
36 set connected=$$CONNECT^XWBM2MC(9230,"127.0.0.1","1>orange;orange>1")
37 quit connected
38
39
40Disconnect()
41 ;"Purpose: to shut down the M-2-M connection.
42 ;"Input: None
43 ;"Results: 1 if closed, 0 if close failed
44
45 new closed
46 set closed=$$CLOSE^XWBM2MC
47 quit closed
48
49
50
51
52Test
53 new IP,PORT,AV,CONTX,RPCN
54 set IP="127.0.0.1",PORT=9230,AV="1>orange;orange>1"
55 set CONTX=""
56 set RPCN="XWB M2M EXAMPLE LARRY"
57 set RPCN="XWB M2M EXAMPLE REF"
58 D EN1^XWBM2MT(CONTX,RPCN,PORT,IP,AV)
59 Q
60 ;
61
62
63Larry ;Example of passing Array (mult).
64
65 if $$Connect()=0 goto Ldone
66
67 I '$$SETCONTX^XWBM2MC("XWB BROKER EXAMPLE") D quit
68 . do HOME^%ZIS U IO W !,"Didn't get Context"
69
70 ;"======================================================
71 write "run #1",!
72 S XWBPARMS("PARAMS",1,"TYPE")="ARRAY"
73 S XWBPARMS("PARAMS",1,"VALUE","Raul")="Programmer"
74 S XWBPARMS("PARAMS",1,"VALUE","Susan")="Tech Writter"
75 S XWBPARMS("PARAMS",1,"VALUE","Dan")="Project Mgr"
76
77 I '$$CALLRPC^XWBM2MC("XWB M2M EXAMPLE LARRY","REQ",1) D
78 . do HOME^%ZIS U IO W !,"Could not run RPC."
79
80 W !,"Result: "
81 F I=1:1 Q:'$D(REQ(I)) W !,REQ(I)
82 W !
83
84 ;"======================================================
85 write "run #2",!
86 S XWBPARMS("PARAMS",1,"TYPE")="ARRAY"
87 S XWBPARMS("PARApArrayMS",1,"VALUE","Raul")="Programmer"
88 S XWBPARMS("PARAMS",1,"VALUE","Susan")="Tech Writter"
89 S XWBPARMS("PARAMS",1,"VALUE","Dan")="Project Mgr"
90 I '$$CALLRPC^XWBM2MC("XWB M2M EXAMPLE LARRY","REQ",1) D
91 . do HOME^%ZIS U IO W !,"Could not run RPC."
92
93 W !,"Result: "
94 F I=1:1 Q:'$D(REQ(I)) W !,REQ(I)
95 W !
96
97 ;"======================================================
98 write "run #3",!
99 S XWBPARMS("PARApArrayMS",1,"TYPE")="ARRAY"
100 S XWBPARMS("PARAMS",1,"VALUE","Raul")="Programmer"
101 S XWBPARMS("PARAMS",1,"VALUE","Susan")="Tech Writter"
102 S XWBPARMS("PARAMS",1,"VALUE","Dan")="Project Mgr"
103 I '$$CALLRPC^XWBM2MC("XWB M2M EXAMPLE LARRY","REQ",1) D
104 . do HOME^%ZIS U IO W !,"Could not run RPC."
105
106 W !,"Result: "
107 F I=1:1 Q:'$D(REQ(I)) W !,REQ(I)
108 W !
109
110 ;"======================================================
111 write "run #4",!
112 S XWBPARMS("PARAMS",1,"TYPE")="ARRAY"
113 S XWBPARMS("PARAMS",1,"VALUE","Raul")="Programmer"
114 S XWBPARMS("PARAMS",1,"VALUE","Susan")="Tech Writter"
115 S XWBPARMS("PARAMS",1,"VALUE","Dan")="Project Mgr"
116 I '$$CALLRPC^XWBM2MC("XWB M2M EXAMPLE LARRY","REQ",1) D
117 . do HOME^%ZIS U IO W !,"Could not run RPC."
118
119 W !,"Result: "
120 F I=1:1 Q:'$D(REQ(I)) W !,REQ(I)
121 W !
122
123 if $$Disconnect=0 do
124 . write "couldn't disconnect!",!
125Ldone
126 Q
Note: See TracBrowser for help on using the repository browser.