| 1 | HDISVM02 ;;CT/GRR SEND MESSAGE ; 02 Mar 2005  4:25 PM
 | 
|---|
| 2 |  ;;1.0;HEALTH DATA & INFORMATICS;**6**;Feb 22, 2005
 | 
|---|
| 3 |  ;
 | 
|---|
| 4 | SNDXML(ARRY,SRVR,HDISINP,SYSPTR) ;Send XML document to server
 | 
|---|
| 5 |  ; Input: ARRY - Array containing XML document (closed root)
 | 
|---|
| 6 |  ;        SRVR - 1 = VUID Server, 2 = Status Update Server
 | 
|---|
| 7 |  ;        HDISINP - Array containing additional info (closed root) (optional)
 | 
|---|
| 8 |  ;                  @HDISINP@(variable) = Value
 | 
|---|
| 9 |  ;                  @HDISINP@(array,subscript) = Value
 | 
|---|
| 10 |  ;                  @HDISINP@(array,subscript_1,subscript_2,...) = Value
 | 
|---|
| 11 |  ;                  
 | 
|---|
| 12 |  ;                  Example:
 | 
|---|
| 13 |  ;                    @HDISINP@("TEST1")=1
 | 
|---|
| 14 |  ;                    @HDISINP@("TEST2")=2
 | 
|---|
| 15 |  ;                    @HDISINP@("TEST2","SUB1")="2A"
 | 
|---|
| 16 |  ;                    @HDISINP@("TEST3","SUB1","SUB2")="3B"
 | 
|---|
| 17 |  ;                  
 | 
|---|
| 18 |  ;                  Results in the following variables/arrays being set:
 | 
|---|
| 19 |  ;                    TEST1=1
 | 
|---|
| 20 |  ;                    TEST2=2
 | 
|---|
| 21 |  ;                    TEST2("SUB1")="2A"
 | 
|---|
| 22 |  ;                    TEST3("SUB1","SUB2")="3B"
 | 
|---|
| 23 |  ;        SYSPTR - Pointer to HDIS System file (optional)
 | 
|---|
| 24 |  ;                 If passed, the destination information is obtained
 | 
|---|
| 25 |  ;                 from the HDIS Parameter file entry for the referenced
 | 
|---|
| 26 |  ;                 system.  By default, the destination information is
 | 
|---|
| 27 |  ;                 pulled from the HDIS Parameter entry for the current
 | 
|---|
| 28 |  ;                 system (which contains the destination information for
 | 
|---|
| 29 |  ;                 the centrally located server)
 | 
|---|
| 30 |  ;Output: None
 | 
|---|
| 31 |  ;        XML document sent to Data Standardization server option
 | 
|---|
| 32 |  ;        at given MailMan domain
 | 
|---|
| 33 |  ;
 | 
|---|
| 34 |  I ARRY=""!(SRVR="") Q "0^Required parameter missing"
 | 
|---|
| 35 |  I SRVR'=1&(SRVR'=2) Q "0^SRVR Parameter invalid"
 | 
|---|
| 36 |  N SUBJECT,HDITO,HDINSTR,HDIXMZ,SERVER,SRVTYP,MAXLIN,SRVROPT
 | 
|---|
| 37 |  S SYSPTR=+$G(SYSPTR)
 | 
|---|
| 38 |  I 'SYSPTR K SYSPTR I '$$CURSYS^HDISVF07(.SYSPTR) Q "0^Unable to determine current system"
 | 
|---|
| 39 |  ;Get location information for VUID Server
 | 
|---|
| 40 |  I SRVR=1 D
 | 
|---|
| 41 |  .S SERVER=$$GETVLOC^HDISVF02(SYSPTR)
 | 
|---|
| 42 |  .S SRVTYP=$$GETVCON^HDISVF02(SYSPTR)
 | 
|---|
| 43 |  .S SRVROPT=$$GETVSRV^HDISVF02(SYSPTR)
 | 
|---|
| 44 |  ;Get location information for Status Server
 | 
|---|
| 45 |  I SRVR=2 D
 | 
|---|
| 46 |  .S SERVER=$$GETSLOC^HDISVF03(SYSPTR)
 | 
|---|
| 47 |  .S SRVTYP=$$GETSCON^HDISVF03(SYSPTR)
 | 
|---|
| 48 |  .S SRVROPT=$$GETSSRV^HDISVF03(SYSPTR)
 | 
|---|
| 49 |  ;Instantiate variables included in input array
 | 
|---|
| 50 |  I $G(HDISINP)]"" D
 | 
|---|
| 51 |  .N ROOT,RSCNT,NODE,NSCNT,TROOT
 | 
|---|
| 52 |  .S ROOT=$$OREF^DILF(HDISINP)
 | 
|---|
| 53 |  .S RSCNT=$QL(HDISINP)
 | 
|---|
| 54 |  .S NODE=HDISINP
 | 
|---|
| 55 |  .F  S NODE=$Q(@NODE) Q:(NODE="")!(NODE'[ROOT)  I $D(@NODE)#2 D
 | 
|---|
| 56 |  ..S NSCNT=$QL(NODE)
 | 
|---|
| 57 |  ..I (NSCNT-RSCNT)=1 S @$QS(NODE,NSCNT)=$G(@NODE) Q
 | 
|---|
| 58 |  ..S TROOT=$QS(NODE,RSCNT+1)_"("_$P(NODE,",",RSCNT+2,NSCNT)
 | 
|---|
| 59 |  ..S @TROOT=$G(@NODE)
 | 
|---|
| 60 |  ;Set message subject
 | 
|---|
| 61 |  I $G(SUBJECT)="" S SUBJECT="XML FORMATTED DATA FROM "_$P($$SITE^VASITE(),"^",2)
 | 
|---|
| 62 |  ;Set message sender
 | 
|---|
| 63 |  S HDINSTR("FROM")="Data Standardization Toolset"
 | 
|---|
| 64 |  ;Set recipient list (includes server option on target server)
 | 
|---|
| 65 |  N HDITO
 | 
|---|
| 66 |  I SERVER="" S HDITO("S."_SRVROPT)=""
 | 
|---|
| 67 |  I SERVER'="" S HDITO("S."_SRVROPT_"@"_SERVER)=""
 | 
|---|
| 68 |  ;Send message to target server
 | 
|---|
| 69 |  D SENDMSG^XMXAPI(DUZ,SUBJECT,ARRY,.HDITO,.HDINSTR,.HDIXMZ)
 | 
|---|
| 70 |  I $G(XMERR) D
 | 
|---|
| 71 |  .;Error sending message - log error text
 | 
|---|
| 72 |  .D ERR2XTMP^HDISVU01("HDI-XM","Message sending",$NA(^TMP("XMERR",$J)))
 | 
|---|
| 73 |  .K XMERR,^TMP("XMERR",$J)
 | 
|---|
| 74 |  Q 1
 | 
|---|
| 75 |  ;
 | 
|---|