source: FOIAVistA/trunk/r/ONCOLOGY-ONC/ONCXDEM.m@ 1754

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

initial load of FOIAVistA 6/30/08 version

File size: 1.5 KB
Line 
1ONCXDEM ;HCIOFO/SG - HTTP AND WEB SERVICES (DEMO) ; 5/14/04 10:59am
2 ;;2.11;ONCOLOGY;**40**;Mar 07, 1995
3 ;
4 Q
5 ;
6 ;***** DEMO ENTRY POINT
7 ;
8 ; The ^TMP($J,"ONCX") global node is used by the entry point.
9 ;
10DEMO ;
11 N BODY,DIR,DIRUT,DTOUT,DUOUT,HEADER,RC,URL,X,Y
12 S BODY=$NA(^TMP($J,"ONCX"))
13 S URL="http://www.hardhats.org"
14 ;
15 S RC=0
16 F D Q:RC
17 . K @BODY,HEADER
18 . ;--- Request a URL from the user
19 . K DIR S DIR(0)="F"
20 . S DIR("A")="URL",DIR("B")=URL
21 . D ^DIR I $D(DIRUT) S RC=1 Q
22 . S URL=$$TRIM^XLFSTR(Y)
23 . ;--- Request the resource
24 . S RC=$$GETURL^ONCX10(URL,,BODY,.HEADER)
25 . I RC<0 D ERROR(RC) S RC=0 Q
26 . ;--- Print the data
27 . D PRINT(BODY,.HEADER)
28 . S RC=0
29 ;
30 ;--- Cleanup
31 K @BODY
32 Q
33 ;
34 ;***** PRINT THE ERROR MESSAGE
35ERROR(ERR) ;
36 W !!,"ERROR: "_$J(+ERR,3)_" "_$P(ERR,U,2),!
37 W $J("",12)_$P(ERR,U,3,4),!
38 Q
39 ;
40 ;***** PAUSES THE OUTPUT IN THE END OF PAGE
41 ;
42 ; N Number of lines to reserve
43 ;
44 ; Return values:
45 ; 0 Ok (continue)
46 ; >0 Exit Request or Timeout
47 ;
48PAGE(N) ;
49 Q:($Y+$G(N))<IOSL 0
50 N DIR,DIRUT,DTOUT,DUOUT,X,Y
51 S DIR(0)="E" D ^DIR W !! S $Y=0
52 Q '$G(Y)
53 ;
54 ;***** PRINTS THE RESPONSE
55PRINT(ONCX8DAT,HEADER) ;
56 N I,J
57 ;---
58 I $D(HEADER)>0 D Q:$$PAGE(IOSL)
59 . W @IOF,"----- HTTP HEADER -----",!!
60 . W $G(HEADER),!
61 . S I=""
62 . F S I=$O(HEADER(I)) Q:I="" W I_"="_HEADER(I),!
63 ;---
64 D:$D(@ONCX8DAT)>1
65 . W @IOF,"----- MESSAGE ONCX8DAT -----",!!
66 . S I=""
67 . F S I=$O(@ONCX8DAT@(I)) Q:I="" W @ONCX8DAT@(I) D W !
68 . . S J="" F S J=$O(@ONCX8DAT@(I,J)) Q:J="" W @ONCX8DAT@(I,J)
69 Q
Note: See TracBrowser for help on using the repository browser.