public void Sample() { // NASH certificate should be used here, NOT the HI/Medicare certificates // The NASH certificate can be found in the NASH PKI Test Kit // To receive the Test Kit fill the application to request a National Authentication Service // for Health(NASH) Public Key Infrastructure(PKI) test certificate kit form // https://myhealthrecorddeveloper.digitalhealth.gov.au/resources/prepare/my-health-record-system-pre-requisites#step-2 // Insure the certificate is installed in Current User -> Personal -> Certificates // (run MMC and add the certificates add - on to view) // The "Issue To" field of a NASH certificate looks like general(or something different)."HPI-O".electronichealth.net.au // "Serial Number" can be found in the details once the certificate is installed. // Type the Serial number, don't copy and paste it, remove the spaces and use uppercase. // Obtain the certificate for use with TLS and signing X509Certificate2 cert = X509CertificateUtil.GetCertificate( "06fba6", X509FindType.FindBySerialNumber, StoreName.My, StoreLocation.CurrentUser, true ); // Create PCEHR header CommonPcehrHeader header = PcehrHeaderHelper.CreateHeader(); // Override this value to the current patient's IHI. header.IhiNumber = "IHI"; // Instantiate the client // SVT endpoint is "https://b2b.ehealthvendortest.health.gov.au/doesPCEHRExist" // Production endpoint is "https://services.ehealth.gov.au/doesPCEHRExist" DoesPCEHRExistClient doesPcehrExistClient = new DoesPCEHRExistClient(new Uri("https://b2b.ehealthvendortest.health.gov.au/doesPCEHRExist"), cert, cert); // Add server certificate validation callback ServicePointManager.ServerCertificateValidationCallback += ValidateServiceCertificate; try { // Invoke the service doesPCEHRExistResponse response = doesPcehrExistClient.DoesPCEHRExist(header); // Get the soap request and response string soapRequest = doesPcehrExistClient.SoapMessages.SoapRequest; string soapResponse = doesPcehrExistClient.SoapMessages.SoapResponse; } catch (FaultException fex) { // Handle any errors } }
public void Run() { //certSerial: "06fba6", //serialHPIO: "8003629900019338", //Get Certificate and Header objects CertAndHeaderInfo CertAndHeaderInfo = Support.CertAndHeaderFactory.Get( certSerial: "06fba6", serialHPIO: "8003629900019338", patientType: Support.PatientType.FrankHarding); // Obtain the certificate for use with TLS and signing X509Certificate2 cert = CertAndHeaderInfo.Certificate; // Create PCEHR header CommonPcehrHeader header = CertAndHeaderInfo.Header; // Instantiate the client // SVT endpoint is "https://b2b.ehealthvendortest.health.gov.au/doesPCEHRExist" // Production endpoint is "https://services.ehealth.gov.au/doesPCEHRExist" DoesPCEHRExistClient doesPcehrExistClient = new DoesPCEHRExistClient(new Uri("https://b2b.ehealthvendortest.health.gov.au/doesPCEHRExist"), cert, cert); // Add server certificate validation callback ServicePointManager.ServerCertificateValidationCallback += Support.CertificateHelper.ValidateServiceCertificate; try { // Invoke the service doesPCEHRExistResponse response = doesPcehrExistClient.DoesPCEHRExist(header); Console.WriteLine($"Success Full at : {DateTime.Now.ToString()}"); Console.WriteLine($"PCEHR Exists: {response.PCEHRExists.ToString()}"); Console.WriteLine($"Access Code Required: {response.accessCodeRequired.ToString()}"); Console.WriteLine($"AccessCodeRequiredSpecified: {response.accessCodeRequiredSpecified.ToString()}"); // Get the soap request and response string soapRequest = doesPcehrExistClient.SoapMessages.SoapRequest; string soapResponse = doesPcehrExistClient.SoapMessages.SoapResponse; } catch (FaultException fex) { // Handle any errors } }