コード例 #1
0
        public void Sample()
        {
            // Obtain the certificate for use with TLS and signing
            X509Certificate2 cert = X509CertificateUtil.GetCertificate(
                "Serial Number",
                X509FindType.FindBySerialNumber,
                StoreName.My,
                StoreLocation.CurrentUser,
                true
                );

            // Create PCEHR header  (See PcehrHeaderHelper.cs)
            CommonPcehrHeader header = PcehrHeaderHelper.CreateHeader();

            // Override this value to the current patient's IHI.
            header.IhiNumber = "IHI";

            // Create the client
            // SVT endpoint is "https://b2b.ehealthvendortest.health.gov.au/getDocument"
            // production endpoint is "https://services.ehealth.gov.au/getDocument"
            GetDocumentClient getDocumentClient = new GetDocumentClient(new Uri("https://GetDocumentEndpoint"), cert, cert);

            // Add server certificate validation callback
            ServicePointManager.ServerCertificateValidationCallback += ValidateServiceCertificate;

            // Create a request
            List <RetrieveDocumentSetRequestTypeDocumentRequest> request =
                new List <RetrieveDocumentSetRequestTypeDocumentRequest>();

            // Set the details of the document to retrieve
            request.Add(new RetrieveDocumentSetRequestTypeDocumentRequest()
            {
                // This should be the value of the ExternalIdentifier "XDSDocumentEntry.uniqueId" in the GetDocumentList response
                DocumentUniqueId = "document unique id",
                // This should be the value of "repositoryUniqueId" in the GetDocumentList response
                RepositoryUniqueId = "repository unique id"
            });

            try
            {
                // Invoke the service
                RetrieveDocumentSetResponseType response = getDocumentClient.GetDocument(header, request.ToArray());
            }
            catch (FaultException e)
            {
                // Handle any errors
            }
        }
コード例 #2
0
        public void Run()
        {
            //Get Certificate and Header objects
            CertAndHeaderInfo CertAndHeaderInfo = Support.CertAndHeaderFactory.Get(
                certSerial: "06fba6",
                serialHPIO: "8003629900019338",
                patientType: Support.PatientType.MaxwellThomas);

            // Obtain the certificate for use with TLS and signing
            X509Certificate2 cert = CertAndHeaderInfo.Certificate;

            // Create PCEHR header
            CommonPcehrHeader header = CertAndHeaderInfo.Header;

            // Create the client
            // SVT endpoint is "https://b2b.ehealthvendortest.health.gov.au/getDocument"
            // production endpoint is "https://services.ehealth.gov.au/getDocument"
            GetDocumentClient getDocumentClient = new GetDocumentClient(new Uri("https://b2b.ehealthvendortest.health.gov.au/getDocument"), cert, cert);

            // Add server certificate validation callback
            ServicePointManager.ServerCertificateValidationCallback += Support.CertificateHelper.ValidateServiceCertificate;

            // Create a request
            List <RetrieveDocumentSetRequestTypeDocumentRequest> request =
                new List <RetrieveDocumentSetRequestTypeDocumentRequest>();

            // Set the details of the document to retrieve
            request.Add(new RetrieveDocumentSetRequestTypeDocumentRequest()
            {
                // This should be the value of the ExternalIdentifier "XDSDocumentEntry.uniqueId" in the GetDocumentList response
                DocumentUniqueId = "2.25.5801464458231145855085038232999883849",
                // This should be the value of "repositoryUniqueId" in the GetDocumentList response
                RepositoryUniqueId = "1.2.36.1.2001.1007.10.8003640002000050"
            });

            try
            {
                // Invoke the service
                RetrieveDocumentSetResponseType response = getDocumentClient.GetDocument(header, request.ToArray());
            }
            catch (FaultException e)
            {
                // Handle any errors
            }
        }
コード例 #3
0
        public RetrieveDocumentSetResponseType GetDocument(string documentId, string repositoryId)
        {
            // Obtain the certificate for use with TLS and signing
            X509Certificate2 cert = X509CertificateUtil.GetCertificate(
                "Serial Number",
                X509FindType.FindBySerialNumber,
                StoreName.My,
                StoreLocation.CurrentUser,
                true
                );

            // Create PCEHR header
            CommonPcehrHeader header = PcehrHeaderHelper.CreateHeader();

            // Create the client
            GetDocumentClient getDocumentClient = new GetDocumentClient(new Uri("https://GetDocumentEndpoint"), cert, cert);

            // Add server certificate validation callback
            ServicePointManager.ServerCertificateValidationCallback += ValidateServiceCertificate;

            // Create a request
            List <RetrieveDocumentSetRequestTypeDocumentRequest> request = new List <RetrieveDocumentSetRequestTypeDocumentRequest>();

            // Set the details of the document to retrieve
            request.Add(new RetrieveDocumentSetRequestTypeDocumentRequest()
            {
                DocumentUniqueId   = documentId,
                RepositoryUniqueId = repositoryId
            });

            try
            {
                // Invoke the service
                RetrieveDocumentSetResponseType response = getDocumentClient.GetDocument(header, request.ToArray());
                return(response);
            }
            catch (FaultException e)
            {
                // Handle any errors
                return(null);
            }
        }