source: ePrescribing/trunk/p/C0PEWD1.m@ 1582

Last change on this file since 1582 was 514, checked in by George Lilly, 16 years ago

web service test routines

File size: 3.3 KB
Line 
1C0PEWD1 ; CCDCCR/GPL - ePrescription utilities; 12/6/08
2 ;;0.1;CCDCCR;nopatch;noreleasedate
3 ;Copyright 2008 WorldVistA. Licensed under the terms of the GNU
4 ;General Public License See attached copy of the License.
5 ;
6 ;This program is free software; you can redistribute it and/or modify
7 ;it under the terms of the GNU General Public License as published by
8 ;the Free Software Foundation; either version 2 of the License, or
9 ;(at your option) any later version.
10 ;
11 ;This program is distributed in the hope that it will be useful,
12 ;but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;GNU General Public License for more details.
15 ;
16 ;You should have received a copy of the GNU General Public License along
17 ;with this program; if not, write to the Free Software Foundation, Inc.,
18 ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 ;
20 Q
21 ;TEST(filepath) ; filepath IS THE PATH/FILE TO BE READ IN
22 i $g(^%ZISH)["" d ; if the VistA Kernal routine %ZISH exists
23 . n zfile,zpath,ztmp s (zfile,zpath,ztmp)=""
24 . s zfile=$re($p($re(filepath),"/",1)) ;file name
25 . s zpath=$p(filepath,zfile,1) ; file path
26 . s ztmp=$na(^CacheTempEWD($j,0))
27 . s ok=$$FTG^%ZISH(zpath,zfile,ztmp,2) ; import the file incrementing subscr 2
28 q
29 ;
30TEST2 ;
31 s zfilepath="/home/vademo2/CCR/PAT_780_CCR_V1_0_17.xml"
32 ;s ok=$$gtmImportFile^%zewdHTMLParser(zfilepath)
33 s ok=$$LOAD(zfilepath) ;load the XML file to the EWD global
34 s ok=$$parseDocument^%zewdHTMLParser("DerekDOM",0)
35 ;s ok=$$parseXMLFile^%zewdAPI(zfilepath,"fourthDOM")
36 w ok,!
37 q
38 ;
39GPLTEST ;
40 ;s ok=$$httpGET^%zewdGTM("http://preproduction.newcropaccounts.com/InterfaceV7/NewrxFDB.xml",.gpl)
41 s URL="https://trac.opensourcevista.net/CCD-CCR-Project/browser/ccr/tags/CCR_1_0_7/output"
42 s ok=$$httpGET^%zewdGTM(URL,.gpl)
43 S ZG=""
44 F S ZG=$O(gpl(ZG)) Q:ZG="" D ;
45 . s gpl(ZG)=$$CLEAN^C0PEWDU(gpl(ZG)) ;
46 . ;w gpl(ZG)
47 m ^CacheTempEWD($j)=gpl
48 b
49 s ok=$$parseDocument^%zewdHTMLParser("gpl2",0)
50 s ok=$$outputDOM^%zewdDOM("gpl2",1,1)
51 Q
52 ;
53GPLTEST2 ;
54 s URL="https://preproduction.newcropaccounts.com/InterfaceV7/NewrxFDB.xml"
55 ;s URL="https://trac.opensourcevista.net/CCD-CCR-Project/browser/ccr/tags/CCR_1_0_7/output"
56 s ok=$$httpGET^%zewdGTM(URL,.gpl)
57 D INDEX^C0CXPATH("gpl","gpl2")
58 S G=""
59 F S G=$O(gpl2(G)) Q:G="" D ;
60 . W !,G," = ",gpl2(G)
61 W !
62 Q
63 ;
64CLEAN(INX) ;DELETE NON-PRINTING CHARACTER IN INX, PASSED BY VALUE
65 ;DON'T USE THIS -- IT DOESN'T WORK -- USE $$CLEAN^C0PEWDU
66 ;N ZT,ZI
67 S ZT=""
68 F ZI=32:1:126 S ZT=ZT_$CHAR(ZI)
69 S ZZ=$TR(INX,ZT)
70 Q ZZ
71 ;
72LOAD(filepath) ; load an xml file into the EWD global for DOM processing
73 ; need to call s error=$$parseDocument^%zewdHTMLParser(docName,isHTML)
74 ; after to process it to the DOM - isHTML=0 for XML files
75 n i
76 i $g(^%ZISH)["" d QUIT i ; if VistA Kernal routine %ZISH exists - gpl 2/23/09
77 . n zfile,zpath,ztmp,zok s (zfile,zpath,ztmp)=""
78 . s zfile=$re($p($re(filepath),"/",1)) ;file name
79 . s zpath=$p(filepath,zfile,1) ; file path
80 . s ztmp=$na(^CacheTempEWD($j,0))
81 . s zok=$$FTG^%ZISH(zpath,zfile,ztmp,2) ; import the file increment subscr 2
82 . s i=$o(^CacheTempEWD($j,""),-1) ; highest line number
83 q i
84 ;
85Q(ZQ,ZD) ; SEND QUERY ZQ TO DOM ZD AND DIPLAY NODES RETURNED
86 I '$D(ZD) S ZD="DerekDOM"
87 s error=$$select^%zewdXPath(ZQ,ZD,.nodes) ;
88 d displayNodes^%zewdXPath(.nodes)
89 q
90 ;
Note: See TracBrowser for help on using the repository browser.