/// <summary>
        /// Removes a document with the document ID.
        /// </summary>
        /// <param name="pcehrHeader">PCEHR header.</param>
        /// <param name="request">Document unique ID and reason for removal.</param>
        /// <returns>Response.</returns>
        public removeDocumentResponse RemoveDocument(CommonPcehrHeader pcehrHeader, removeDocument request)
        {
            Validation.ValidateArgumentRequired("request", request);

            var timestamp = new timestampType()
            {
                created = DateTime.Now
            };

            var signatureContainer = new signatureContainerType();

            return(removeDocumentClient.removeDocument(timestamp, ref signatureContainer, pcehrHeader.GetHeader <PCEHRHeader>(), request));
        }
Example #2
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
            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/removeDocument"
            // production endpoint is "https://services.ehealth.gov.au:443/removeDocument"
            RemoveDocumentClient removeDocumentClient = new RemoveDocumentClient(
                new Uri("https://RemoveDocumentEndpoint"), cert, cert);

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

            try
            {
                var request = new removeDocument()
                {
                    // this should be the value of the ExternalIdentifier "XDSDocumentEntry.uniqueId" in the GetDocumentList response
                    documentID = "document ID",
                    // reasonForRemoval should be one of:
                    // removeDocumentReasonForRemoval.IncorrectIdentity
                    // removeDocumentReasonForRemoval.ElectToRemove
                    // removeDocumentReasonForRemoval.Withdrawn
                    reasonForRemoval = removeDocumentReasonForRemoval.Withdrawn
                };

                // Invoke the service
                var responseStatus = removeDocumentClient.RemoveDocument(header, request);

                // Get the soap request and response
                string soapRequest  = removeDocumentClient.SoapMessages.SoapRequest;
                string soapResponse = removeDocumentClient.SoapMessages.SoapResponse;
            }
            catch (FaultException fex)
            {
                // Handle any errors
            }
        }
        public void Remove()
        {
            //Get Certificate and Header objects
            CertAndHeaderInfo CertAndHeaderInfo = Support.CertAndHeaderFactory.Get(
                certSerial: "06fba6",
                serialHPIO: "8003629900019338",
                patientType: Support.PatientType.LudwigHOBBS);

            // 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/removeDocument"
            // production endpoint is "https://services.ehealth.gov.au:443/removeDocument"
            RemoveDocumentClient removeDocumentClient = new RemoveDocumentClient(
                new Uri("https://b2b.ehealthvendortest.health.gov.au/removeDocument"), cert, cert);

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

            try
            {
                var request = new removeDocument()
                {
                    // this should be the value of the ExternalIdentifier "XDSDocumentEntry.uniqueId" in the GetDocumentList response
                    documentID = "2.25.262187743541392638493047310439698728609",
                    // reasonForRemoval should be one of:
                    // removeDocumentReasonForRemoval.IncorrectIdentity
                    // removeDocumentReasonForRemoval.ElectToRemove
                    // removeDocumentReasonForRemoval.Withdrawn
                    reasonForRemoval = removeDocumentReasonForRemoval.Withdrawn
                };

                // Invoke the service
                var responseStatus = removeDocumentClient.RemoveDocument(header, request);

                // Get the soap request and response
                string soapRequest  = removeDocumentClient.SoapMessages.SoapRequest;
                string soapResponse = removeDocumentClient.SoapMessages.SoapResponse;
            }
            catch (FaultException fex)
            {
                // Handle any errors
            }
        }