source: WorldVistAEHR/trunk/r/ONCOLOGY-ONC/ONCSAPIV.m@ 1361

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

initial load of WorldVistAEHR

File size: 3.2 KB
Line 
1ONCSAPIV ;Hines OIFO/SG - ONCOLOGY WEB SERVICE (VERSIONS) ; 12/7/06 2:25pm
2 ;;2.11;ONCOLOGY;**40,47**;Mar 07, 1995;Build 19
3 ;
4 Q
5 ;
6 ;***** CHECKS THE VERSION OF THE LOCAL CACHE
7 ;
8 ; [.ONCSAPI] Reference to the API descriptor (see ^ONCSAPI)
9 ;
10 ; Return Values:
11 ; 0 Ok
12 ; <0 Error code
13 ;
14CHKVER(ONCSAPI) ;
15 N NODE,RC,TMP,VER
16 D CLEAR^ONCSAPIE()
17 ;--- Get the versions of web-service components
18 S VER=$$VERSION(.ONCSAPI) Q:VER<0 VER
19 ;--- Lock the cache
20 S NODE=$NA(^XTMP("ONCSAPI"))
21 L +@NODE:5 E Q $$ERROR^ONCSAPIE(-15,,"local cache")
22 ;--- Check the version of the local CS table cache
23 S TMP=$P(VER,U,2)
24 I TMP'="",$G(@NODE@("TABLES"))'=TMP D S @NODE@("TABLES")=TMP
25 . K @NODE@("TABLES"),@NODE@("SCHEMAS")
26 ;--- Check the version of the local edit info cache
27 S TMP=$P(VER,U,3)
28 I TMP'="",$G(@NODE@("EDITS"))'=TMP D S @NODE@("EDITS")=TMP
29 . K @NODE@("EDITS")
30 ;--- Refresh the cache descriptor
31 S TMP=$$FMADD^XLFDT(DT,30)
32 S @NODE@(0)=TMP_U_DT_U_"Local Oncology seb-service cache"
33 L -@NODE
34 Q 0
35 ;
36 ;***** SETS THE EVENT INTERFACE ENTRY POINTS
37 ;
38 ; .CBK Reference to the destination list
39 ;
40SETCBK(CBK) ;
41 ;;CHARACTERS^TEXT^ONCSAPIV
42 ;
43 D SETCBK^ONCSAPIX(.CBK,"SETCBK^ONCSAPIV")
44 Q
45 ;
46 ;***** TEXT CALLBACK FOR THE SAX PARSER
47 ;
48 ; TXT Line of unmarked text
49 ;
50TEXT(TXT) ;
51 N L,L2E
52 S L=$L(ONCXML("PATH"),","),L2E=$P(ONCXML("PATH"),",",L-1,L)
53 ;--- CS API version
54 I L2E="RESPONSE,CS-APIVER" S ONCXML("CS-APIVER")=TXT Q
55 ;--- EDITS metafile version
56 I L2E="RESPONSE,ED-METAVER" S ONCXML("ED-METAVER")=TXT Q
57 ;--- Oncology web-service version
58 I L2E="RESPONSE,VERSION" S ONCXML("VERSION")=TXT Q
59 ;--- Default processing
60 D TEXT^ONCSAPIX(TXT)
61 Q
62 ;
63 ;***** RETURNS THE WEB-SERVICE VERSIONS
64 ;
65 ; [.ONCSAPI] Reference to the API descriptor (see ^ONCSAPI)
66 ;
67 ; The ^TMP("ONCSAPIV",$J) global node is used by this function.
68 ;
69 ; Return Values:
70 ; <0 Error code
71 ; Versions (e.g. "2.00^010300^2.00)
72 ; ^01: Oncology web-service version
73 ; ^02: Version of the CS DLL
74 ; ^03: EDITS metafile version
75 ;
76VERSION(ONCSAPI) ;
77 N CBK,ONCREQ,ONCRSP,ONCXML,RC,URL
78 D CLEAR^ONCSAPIE()
79 S ONCRSP=$NA(^TMP("ONCSAPIV",$J)) K @ONCRSP
80 ;--- Get the server URL
81 S URL=$$GETCSURL^ONCSAPIU()
82 ;
83 S RC=0 D
84 . ;--- Prepare the request data
85 . S RC=$$PARAMS^ONCSAPIR("ONCREQ","GET-VERSION") Q:RC<0
86 . ;--- Request the DLL version
87 . D:$G(ONCSAPI("DEBUG"))
88 . . D ZW^ONCSAPIU("ONCREQ","*** 'VERSION' REQUEST ***",1)
89 . S RC=$$REQUEST^ONCSAPIR(URL,ONCRSP,"ONCREQ") Q:RC<0
90 . D:$G(ONCSAPI("DEBUG"))
91 . . D ZW^ONCSAPIU(ONCRSP,"*** 'VERSION' RESPONSE ***",1)
92 . K ONCREQ
93 . ;--- Parse the response
94 . D SETCBK(.CBK),EN^MXMLPRSE(ONCRSP,.CBK,"W")
95 . ;--- Check for parsing and web-service errors
96 . S RC=$$CHKERR^ONCSAPIR(.ONCXML) Q:RC<0
97 . ;--- Check the version numbers
98 . I $G(ONCXML("CS-APIVER"))="" S RC=$$ERROR^ONCSAPIE(-13) Q
99 . I $G(ONCXML("ED-METAVER"))="" S RC=$$ERROR^ONCSAPIE(-23) Q
100 ;
101 ;--- Cleanup
102 K @ONCRSP
103 I RC'<0 S RC="" D
104 . S $P(RC,U,1)=$G(ONCXML("VERSION")) ; Web-service
105 . S $P(RC,U,2)=$G(ONCXML("CS-APIVER")) ; CS API
106 . S $P(RC,U,3)=$G(ONCXML("ED-METAVER")) ; EDITS metafile
107 Q RC
Note: See TracBrowser for help on using the repository browser.