Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: VBECRPC1

VBECRPC1.m

Go to the documentation of this file.
  1. VBECRPC1 ;HINES OIFO/BNT - RPC Server Listener Code ;12/28/03 11:20
  1. ;;2.0;VBEC;**8**;Jun 05, 2015;Build 27
  1. ;
  1. ; Note: This routine supports data exchange with an FDA registered
  1. ; medical device. As such, it may not be changed in any way without
  1. ; prior written approval from the medical device manufacturer.
  1. ;
  1. ; Integration Agreements:
  1. ; Reference DBIA 4149 - M XML Parser
  1. ; Reference to EN^MXMLPRSE supported by IA #4149
  1. ;
  1. QUIT
  1. ;
  1. ; -----------------------------------------------------------------------
  1. ; Parse Results of Successful Legacy RPC Request
  1. ; -----------------------------------------------------------------------
  1. ;
  1. ; [Public/Supported Method]
  1. PARSE(VBECPRMS,VBECY) ; -- parse legacy rpc results ; uses SAX parser
  1. NEW VBECCBK,VBECOPT,VBECTYPE,VBECCNT
  1. S VBMT=$NA(^TMP("VBECS_MAIL_TEXT",$J)) K @VBMT
  1. DO SET(.VBECCBK)
  1. SET VBECOPT=""
  1. DO EN^MXMLPRSE(VBECPRMS("RESULTS"),.VBECCBK,.VBECOPT)
  1. I $D(@VBECY@("ERROR")) D
  1. . D BLDERMSG^VBECRPC(.VBECPRMS,VBECY,VBMT)
  1. . D SENDMSG^VBECRPC(VBMT,"VBECS VistALink Client","G.VBECS INTERFACE ADMIN","VBECS VistALink Error")
  1. . K @VBMT
  1. Q
  1. ;
  1. SET(VBECCBK) ; -- set the event interface entry points
  1. SET VBECCBK("STARTELEMENT")="RESELEST^VBECRPC1"
  1. SET VBECCBK("ENDELEMENT")="RESELEND^VBECRPC1"
  1. SET VBECCBK("CHARACTERS")="RESCHR^VBECRPC1"
  1. QUIT
  1. ;
  1. RESELEST(ELE,ATR) ; -- element start event handler
  1. IF ELE="Response" SET VBECTYPE=$G(ATR("type")),VBECCNT=0 QUIT
  1. IF ELE="Message" SET VBECTYPE="fault",VBECCNT=0 QUIT
  1. QUIT
  1. ;
  1. RESELEND(ELE) ; -- element end event handler
  1. KILL VBECCNT,VBECTYPE
  1. QUIT
  1. ;
  1. RESCHR(TEXT) ; -- character value event handler
  1. QUIT:$G(VBECTYPE)=""
  1. QUIT:'$L(TEXT) ; -- bug in parser? sends in empty string
  1. ;
  1. IF VBECCNT=0,TEXT=$C(10) QUIT ; -- bug in parser? always starts with $C(10)
  1. ;
  1. IF VBECTYPE="string" DO QUIT
  1. . SET VBECCNT=VBECCNT+1
  1. . SET @VBECY@(VBECCNT)=TEXT
  1. ;
  1. IF VBECTYPE="array" DO
  1. . SET VBECCNT=VBECCNT+1
  1. . SET @VBECY@(VBECCNT)=$P(TEXT,$C(10))
  1. ;
  1. IF VBECTYPE="fault" DO
  1. . SET VBECCNT=VBECCNT+1
  1. . SET @VBECY@("ERROR")=TEXT
  1. QUIT
  1. ;
  1. PARSEX(VBECPRMS,VBECY) ; -- parse legacy rpc results ; uses DOM parser
  1. NEW VBECDOM
  1. SET VBECDOM=$$EN^MXMLDOM(VBECPRMS("RESULTS"),"")
  1. DO TEXT^MXMLDOM(VBECDOM,2,VBECY)
  1. DO DELETE^MXMLDOM(VBECDOM)
  1. QUIT
  1. ;
  1. ; -------------------------------------------------------------------
  1. ; Response Format Documentation
  1. ; -------------------------------------------------------------------
  1. ;
  1. ;
  1. ; [ Sample XML produced by a successful call of EN^XOBRPC(.VBECPRMS).
  1. ; SEND^XOBRPC does the actual work to produce response. ]
  1. ;
  1. ; <?xml version="1.0" encoding="utf-8" ?>
  1. ; <vistalink type="Gov.VA.Med.RPC.Response" >
  1. ; <results type="array" >
  1. ; <![CDATA[4261;;2961001.08^2^274^166^105^^2961001.1123^1^^9^2^8^10^^^^^^^10G1-ALN
  1. ; 4270;;2961002.08^2^274^166^112^^^1^^9^2^8^10^^^^^^^10G8-ALN
  1. ; 4274;;2961003.08^2^274^166^116^^^1^^9^2^8^10^^^^^^^10GD-ALN
  1. ; 4340;;2961117.08^2^274^166^182^^2961118.1425^1^^9^2^8^10^^^^^^^10K0-ALN
  1. ; 4342;;2961108.13^2^108^207^183^^2961118.1546^1^^9^2^8^10^^^^^^^10K2-ALN
  1. ; 6394;;3000607.084^2^165^68^6479^^3000622.13^1^^9^1^8^10^^^^^^^197M-ALN]]>
  1. ; </results>
  1. ; </vistalink>
  1. ;
  1. ; -------------------------------------------------------------------
  1. ;
  1. ; [ Sample XML produced by a unsuccessful call of EN^XOBRPC(.XOBPARMS).
  1. ; ERROR^XOBRPC does the actual work to produce response. ]
  1. ;
  1. ; <?xml version="1.0" encoding="utf-8" ?>
  1. ; <vistalink type="Gov.VA..Med.RPC.Error" >
  1. ; <errors>
  1. ; <error code="2" uri="XOB BAD NAME" >
  1. ; <msg>
  1. ; Remote Procedure Unknown: 'XOB BAD NAME' cannot be found.
  1. ; </msg>
  1. ; </error>
  1. ; </errors>
  1. ; </vistalink>
  1. ;
  1. ; -------------------------------------------------------------------
  1. ;