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 } }
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 } }
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); } }
// Sample code for getting Medicine View CDA document // Until getView returns Medicine View, two calls need to be made, // 1) getDocumentList to retrieve the doc id of the Mediciew View CDA document // 2) getDocument public void SampleForMedicineViewResponse() { string documentId = ""; string repositoryId = ""; GetDocumentId("IHI Number", out documentId, out repositoryId); if (repositoryId != "" && documentId != "") { RetrieveDocumentSetResponseType response = GetDocument(documentId, repositoryId); // response if (response.DocumentResponse != null && response.DocumentResponse.Length == 1) { //Zip file byte[] zipFile = response.DocumentResponse[0].Document; // Proceed to unzip and render using generic style sheet } } }