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

XOBWPB04.m

Go to the documentation of this file.
  1. XOBWPB04 ;OAK/BDT - HWSC :: Environmental Check ; 06/28/2016
  1. ;;1.0;HwscWebServiceClient;**4**;September 13, 2010;Build 9
  1. ;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. ; ***** IMPORTANT NOTE *******************************************
  1. ; This routine requires access to the manager (%SYS) namespace and
  1. ; can only be run by a user with permissions to that namespace.
  1. ; ****************************************************************
  1. ;
  1. ; Loads "xobw4b.xml" into XOBW*1*4 transport global. Post-installation
  1. ; routine ^XOBWPA04 will reconstruct the file for the installation of Cache
  1. ; classes into VistA to support SSL. The "xobw4.xml"
  1. ; file must be in the PRIMARY HFS DIRECTORY prior to transport.
  1. ;
  1. ; Note: Make sure that there are no lines longer than 255 chars in the file
  1. ; to be loaded! It appears $$FTG is not creating overflow nodes.
  1. ;
  1. POST ;
  1. D SETDATA ;
  1. D IMPDATA ;
  1. Q
  1. GETDATA ; export data from xobw4b.xml file
  1. N I,X,XFILE,XPATH,XREF
  1. K ^TMP($J,4)
  1. S XFILE="xobw4b.xml"
  1. S XPATH=$$DEFDIR^%ZISH ;PRIMARY HFS DIRECTORY
  1. S XREF="^TMP("_$J_",4,1,0)"
  1. S X=$$FTG^%ZISH(XPATH,XFILE,XREF,3) ;Load file into global
  1. Q
  1. ;
  1. IMPDATA ; import data into xobw4b.xml file
  1. N XDIR,XOBWY,Y
  1. S XDIR=$$DEFDIR^%ZISH
  1. S XREF="^TMP("_$J_",4,1,0)"
  1. S Y=$$GTF^%ZISH(XREF,3,XDIR,"xobw4b.xml") ;Export ^TMP global to XML file
  1. K ^TMP($J,4)
  1. S XDIR=$$DEFDIR^%ZISH
  1. S XOBWY=$$IMPORT^XOBWLIB1(XDIR,"xobw4b.xml") ;Import Cache classes
  1. IF 'XOBWY DO
  1. . DO BMES^XPDUTL("Error occurred during the importing of support classes file:")
  1. . DO MES^XPDUTL(" Directory: "_XDIR)
  1. . DO MES^XPDUTL(" File Name: "_"xobw4b.xml")
  1. . DO MES^XPDUTL(" Error: "_$PIECE(XOBWY,"^",2))
  1. . DO MES^XPDUTL(" o Classes not imported.")
  1. ELSE DO
  1. . DO MES^XPDUTL(" o Support classes imported successfully.")
  1. . DO MES^XPDUTL(" ")
  1. Q
  1. ;
  1. SETDATA ;
  1. N I,IT
  1. K ^TMP($J,4)
  1. F I=1:1:323 S IT=$T(DATA+I) S ^TMP($J,4,I,0)=$P(IT," ;;",2,99)
  1. Q
  1. DATA ;
  1. ;;<?xml version="1.0" encoding="UTF-8"?>
  1. ;;<Export generator="Cache" version="25" zv="Cache for UNIX (Red Hat Enterprise Linux for x86-64) 2014.1.3 (Build 775)" ts="2016-06-22 15:48:50">
  1. ;;<Class name="xobw.WebServer">
  1. ;;<Description><![CDATA[
  1. ;;This persistent class contains web server connection information used to connect to server hosting web services
  1. ;;<br>
  1. ;;This class is mapped to the VA FileMan WEB SERVER (#18.12) file
  1. ;;<br><br>
  1. ;;<b>Restricted Use:</b> The properties and methods of this class are for HWSC use only.
  1. ;; ]]></Description>
  1. ;;<ClassType>persistent</ClassType>
  1. ;;<ProcedureBlock>1</ProcedureBlock>
  1. ;;<SqlRowIdPrivate>1</SqlRowIdPrivate>
  1. ;;<SqlTableName>WebServer</SqlTableName>
  1. ;;<StorageStrategy>WebServerStorage</StorageStrategy>
  1. ;;<Super>%Persistent</Super>
  1. ;;<TimeChanged>64091,56835.117773</TimeChanged>
  1. ;;<TimeCreated>60654,21265.065878</TimeCreated>
  1. ;;
  1. ;;<UDLText name="T">
  1. ;;<Content><![CDATA[
  1. ;;// 1.0;HwscWebServiceClient;;September 13, 2010
  1. ;;
  1. ;;]]></Content>
  1. ;;</UDLText>
  1. ;;
  1. ;;<UDLText name="T">
  1. ;;<Content><![CDATA[
  1. ;;// HealtheVet Web Service Client v1 [Build: 1.0.1.009]
  1. ;;
  1. ;;]]></Content>
  1. ;;</UDLText>
  1. ;;
  1. ;;<Index name="ienIndex">
  1. ;;<IdKey>1</IdKey>
  1. ;;<PrimaryKey>1</PrimaryKey>
  1. ;;<Properties>ien</Properties>
  1. ;;<Unique>1</Unique>
  1. ;;</Index>
  1. ;;
  1. ;;<Property name="server">
  1. ;;<Type>%String</Type>
  1. ;;<Parameter name="TRUNCATE" value="1"/>
  1. ;;</Property>
  1. ;;
  1. ;;<Property name="port">
  1. ;;<Type>%Integer</Type>
  1. ;;<Collection/>
  1. ;;<Relationship>0</Relationship>
  1. ;;</Property>
  1. ;;
  1. ;;<Property name="ien">
  1. ;;<Type>%String</Type>
  1. ;;<Collection/>
  1. ;;<Relationship>0</Relationship>
  1. ;;<Parameter name="TRUNCATE" value="1"/>
  1. ;;</Property>
  1. ;;
  1. ;;<Property name="name">
  1. ;;<Type>%String</Type>
  1. ;;<Collection/>
  1. ;;<Relationship>0</Relationship>
  1. ;;<Parameter name="TRUNCATE" value="1"/>
  1. ;;</Property>
  1. ;;
  1. ;;<Property name="production">
  1. ;;<Type>%Boolean</Type>
  1. ;;<Collection/>
  1. ;;<Relationship>0</Relationship>
  1. ;;<Transient>1</Transient>
  1. ;;</Property>
  1. ;;
  1. ;;<UDLText name="T">
  1. ;;<Content><![CDATA[
  1. ;;// server credentials
  1. ;;
  1. ;;]]></Content>
  1. ;;</UDLText>
  1. ;;
  1. ;;<Property name="loginRequired">
  1. ;;<Type>%Boolean</Type>
  1. ;;<SqlFieldName>loginRequired</SqlFieldName>
  1. ;;</Property>
  1. ;;
  1. ;;<Property name="password">
  1. ;;<Type>%String</Type>
  1. ;;<Private>1</Private>
  1. ;;<SqlFieldName>password</SqlFieldName>
  1. ;;<Parameter name="TRUNCATE" value="1"/>
  1. ;;</Property>
  1. ;;
  1. ;;<Property name="userName">
  1. ;;<Type>%String</Type>
  1. ;;<SqlFieldName>userName</SqlFieldName>
  1. ;;<Parameter name="TRUNCATE" value="1"/>
  1. ;;</Property>
  1. ;;
  1. ;;<Property name="defaultTimeout">
  1. ;;<Type>%Integer</Type>
  1. ;;<InitialExpression>30</InitialExpression>
  1. ;;<SqlFieldName>defaultTimeout</SqlFieldName>
  1. ;;<Parameter name="MAXVAL" value="7200"/>
  1. ;;<Parameter name="MINVAL" value="5"/>
  1. ;;</Property>
  1. ;;
  1. ;;<Property name="sslEnabled">
  1. ;;<Type>%Boolean</Type>
  1. ;;<SqlFieldName>sslEnabled</SqlFieldName>
  1. ;;</Property>
  1. ;;
  1. ;;<Property name="sslConfiguration">
  1. ;;<Type>%String</Type>
  1. ;;<SqlFieldName>sslConfiguration</SqlFieldName>
  1. ;;<Parameter name="TRUNCATE" value="1"/>
  1. ;;</Property>
  1. ;;
  1. ;;<Property name="sslPort">
  1. ;;<Type>%String</Type>
  1. ;;<SqlFieldName>sslPort</SqlFieldName>
  1. ;;<Parameter name="TRUNCATE" value="1"/>
  1. ;;</Property>
  1. ;;
  1. ;;<UDLText name="T">
  1. ;;<Content><![CDATA[
  1. ;;// for ISS use ------------------------
  1. ;;
  1. ;;]]></Content>
  1. ;;</UDLText>
  1. ;;
  1. ;;<Property name="authorizedWebServices">
  1. ;;<Type>xobw.WebServicesAuthorized</Type>
  1. ;;<Cardinality>children</Cardinality>
  1. ;;<Inverse>webServerRef</Inverse>
  1. ;;<Relationship>1</Relationship>
  1. ;;</Property>
  1. ;;
  1. ;;<Property name="status">
  1. ;;<Type>%Boolean</Type>
  1. ;;<Collection/>
  1. ;;<Relationship>0</Relationship>
  1. ;;</Property>
  1. ;;
  1. ;;<Method name="getPassword">
  1. ;;<ReturnType>%String</ReturnType>
  1. ;;<Implementation><![CDATA[ quit $$DECRYP^XOBWPWD(..password)
  1. ;;]]></Implementation>
  1. ;;</Method>
  1. ;;
  1. ;;<Method name="checkWebServicesAvailability">
  1. ;;<FormalSpec>dots:%String</FormalSpec>
  1. ;;<ReturnType>%Library.ListOfDataTypes</ReturnType>
  1. ;;<Implementation><![CDATA[
  1. ;; set key = ""
  1. ;; set count=0
  1. ;; set result=##class(%ListOfDataTypes).%New()
  1. ;;
  1. ;; // if server is disabled, stop
  1. ;; if '..status {
  1. ;; do result.Insert("")
  1. ;; do result.Insert(" o Web server is disabled")
  1. ;; do result.Insert("")
  1. ;; quit result
  1. ;; }
  1. ;;
  1. ;; // loop thru web services credentials defined for server and build list output
  1. ;; // mainly for ListMan consumption (AVAIL^XOBWUT1)
  1. ;; do {
  1. ;; set authorizedWebService = ..authorizedWebServices.GetNext(.key)
  1. ;; if $get(dots) write "."
  1. ;; set count=count+1
  1. ;; if (authorizedWebService '= $$$NULLOREF) {
  1. ;; set webService=##class(xobw.WebServiceMetadata).%OpenId(authorizedWebService.webServiceIen)
  1. ;; if (authorizedWebService.status) {
  1. ;; if ((webService.type=1) || (webService.type=2)) {
  1. ;; if ##class(xobw.WebServiceMetadata).checkResourceAvailability(##this,authorizedWebService,webService,.httpStatusCode) {
  1. ;; do result.Insert(count_" "_webService.name_" is available")
  1. ;; } else {
  1. ;; do result.Insert(count_" Unable to retrieve '"_webService.availResource_"' for "_webService.name)
  1. ;; //
  1. ;; // the following lines will report spurious %objlasterror errors.
  1. ;; // supposed to be fixed in Cache 5.1+.
  1. ;; //
  1. ;; if ($data(%objlasterror)'=0) {
  1. ;; do $system.Status.DecomposeStatus(%objlasterror,.err)
  1. ;; set x=$get(err(1)," o no reason available")
  1. ;; set length=$length(x)
  1. ;; do result.Insert(" o "_$extract(x,1,70))
  1. ;; set x=$extract(x,71,length)
  1. ;; while (x'="") {
  1. ;; do result.Insert(" "_$extract(x,1,70))
  1. ;; set x=$extract(x,71,length)
  1. ;; } // while
  1. ;; // if there is a status code, show it
  1. ;; if $get(httpStatusCode)]"" do result.Insert(" o HTTP Response Status Code: "_httpStatusCode)
  1. ;; } else {
  1. ;; do result.Insert(" o HTTP Response Status Code: "_$get(httpStatusCode,"<no status code available>"))
  1. ;; } // %objlasterror
  1. ;; } // resource availability
  1. ;; } else {
  1. ;; do result.Insert(count_" "_webService.name_" is not a valid web service type ["_webservice.type_"]")
  1. ;; } // not valid type (rare and should not occur)
  1. ;; } else {
  1. ;; do result.Insert(count_" "_webService.name_" is not enabled")
  1. ;; } // authorizedWebService.status
  1. ;; } // authorizedWebService
  1. ;; } while (key '= "")
  1. ;; quit result
  1. ;;]]></Implementation>
  1. ;;</Method>
  1. ;;
  1. ;;<Method name="getWebServerId">
  1. ;;<ClassMethod>1</ClassMethod>
  1. ;;<FormalSpec>name:%String</FormalSpec>
  1. ;;<ReturnType>%String</ReturnType>
  1. ;;<Implementation><![CDATA[
  1. ;; if $get(name)="" {
  1. ;; do ##class(xobw.error.DialogError).forceError(186005_"^<empty string>")
  1. ;; }
  1. ;; quit +$order(^XOB(18.12,"B",name,0))
  1. ;;]]></Implementation>
  1. ;;</Method>
  1. ;;
  1. ;;<Method name="setUpHttpRequest">
  1. ;;<FormalSpec>httpRequest:%Net.HttpRequest</FormalSpec>
  1. ;;<Implementation><![CDATA[
  1. ;; if (..sslEnabled && ('$$SSLOK^XOBWENV())) {
  1. ;; do ##class(xobw.error.DialogError).forceError(186002_"^"_..name_" (SSL is disabled on VMS)")
  1. ;; }
  1. ;; if (..sslEnabled) {
  1. ;; set httpRequest.Https=1
  1. ;; set httpRequest.SSLConfiguration=..sslConfiguration
  1. ;; set httpRequest.Port=..sslPort
  1. ;; set httpRequest.SSLCheckServerIdentity = 0
  1. ;; } else {
  1. ;; set httpRequest.Port=..port
  1. ;; }
  1. ;; // common setting
  1. ;; set httpRequest.Server=..server
  1. ;; set httpRequest.Timeout=..defaultTimeout
  1. ;; quit
  1. ;;]]></Implementation>
  1. ;;</Method>
  1. ;;
  1. ;;<Method name="defaultTimeoutGet">
  1. ;;<ReturnType>%Integer</ReturnType>
  1. ;;<Implementation><![CDATA[ quit $select(i%defaultTimeout:i%defaultTimeout,1:30)
  1. ;;]]></Implementation>
  1. ;;</Method>
  1. ;;
  1. ;;<Storage name="WebServerStorage">
  1. ;;<Type>%CacheSQLStorage</Type>
  1. ;;<StreamLocation>^xobw.WebServerS</StreamLocation>
  1. ;;<ExtentSize>100000</ExtentSize>
  1. ;;<SQLMap name="MasterMap">
  1. ;;<Type>data</Type>
  1. ;;<Global>^XOB</Global>
  1. ;;<Subscript name="1">
  1. ;;<Expression>18.12</Expression>
  1. ;;</Subscript>
  1. ;;<Subscript name="2">
  1. ;;<Expression>{ien}</Expression>
  1. ;;<LoopInitValue>0</LoopInitValue>
  1. ;;<StopExpression>'+{L2}</StopExpression>
  1. ;;</Subscript>
  1. ;;<RowIdSpec name="1">
  1. ;;<Expression>{L2}</Expression>
  1. ;;<Field>ien</Field>
  1. ;;</RowIdSpec>
  1. ;;<Data name="defaultTimeout">
  1. ;;<Delimiter>"^"</Delimiter>
  1. ;;<Node>0</Node>
  1. ;;<Piece>7</Piece>
  1. ;;</Data>
  1. ;;<Data name="loginRequired">
  1. ;;<Delimiter>"^"</Delimiter>
  1. ;;<Node>1</Node>
  1. ;;<Piece>1</Piece>
  1. ;;</Data>
  1. ;;<Data name="name">
  1. ;;<Delimiter>"^"</Delimiter>
  1. ;;<Node>0</Node>
  1. ;;<Piece>1</Piece>
  1. ;;</Data>
  1. ;;<Data name="password">
  1. ;;<Node>300</Node>
  1. ;;</Data>
  1. ;;<Data name="port">
  1. ;;<Delimiter>"^"</Delimiter>
  1. ;;<Node>0</Node>
  1. ;;<Piece>3</Piece>
  1. ;;</Data>
  1. ;;<Data name="server">
  1. ;;<Delimiter>"^"</Delimiter>
  1. ;;<Node>0</Node>
  1. ;;<Piece>4</Piece>
  1. ;;</Data>
  1. ;;<Data name="sslConfiguration">
  1. ;;<Delimiter>"^"</Delimiter>
  1. ;;<Node>3</Node>
  1. ;;<Piece>2</Piece>
  1. ;;</Data>
  1. ;;<Data name="sslEnabled">
  1. ;;<Delimiter>"^"</Delimiter>
  1. ;;<Node>3</Node>
  1. ;;<Piece>1</Piece>
  1. ;;</Data>
  1. ;;<Data name="sslPort">
  1. ;;<Delimiter>"^"</Delimiter>
  1. ;;<Node>3</Node>
  1. ;;<Piece>3</Piece>
  1. ;;</Data>
  1. ;;<Data name="status">
  1. ;;<Delimiter>"^"</Delimiter>
  1. ;;<Node>0</Node>
  1. ;;<Piece>6</Piece>
  1. ;;</Data>
  1. ;;<Data name="userName">
  1. ;;<Node>200</Node>
  1. ;;</Data>
  1. ;;</SQLMap>
  1. ;;</Storage>
  1. ;;</Class>
  1. ;;</Export>