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 byte[] GetDealsheet(string pTradingSysCode, string pTradingSysKey, out string pDocType) { byte[] resultDoc = null; GetDocumentClient client = new GetDocumentClient(GET_DOCUMENT_ENDPOINT, urlStr); client.ClientCredentials.UserName.UserName = svcUserName; client.ClientCredentials.UserName.Password = svcPassword; GetDealSheetResponse response = new GetDealSheetResponse(); GetDealSheetRequest request = new GetDealSheetRequest(); request.tradingSystemCode = pTradingSysCode; request.tradingSystemKey = pTradingSysKey; response = client.getDealSheet(request); pDocType = response.objectFormatInd.ToString(); resultDoc = response.objectStream; return resultDoc; }
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); } }
public byte[] GetDealsheet(string pTradingSysCode, string pTradingSysKey, out string pDocType) { byte[] resultDoc = null; GetDocumentClient client = new GetDocumentClient(GET_DOCUMENT_ENDPOINT, urlStr); client.ClientCredentials.UserName.UserName = svcUserName; client.ClientCredentials.UserName.Password = svcPassword; GetDealSheetResponse response = new GetDealSheetResponse(); GetDealSheetRequest request = new GetDealSheetRequest(); request.tradingSystemCode = pTradingSysCode; request.tradingSystemKey = pTradingSysKey; response = client.getDealSheet(request); pDocType = response.objectFormatInd.ToString(); resultDoc = response.objectStream; return(resultDoc); }
public byte[] GetConfirm(string pTradingSysCode, string pTradingSysKey, string pTemplateName, out string pDocType) { byte[] resultDoc = null; string getDocumentUrl = baseUrlStr + @"/" + GET_DOCUMENT_URL_EXT; GetDocumentClient client = new GetDocumentClient(GET_DOCUMENT_ENDPOINT, getDocumentUrl); client.ClientCredentials.UserName.UserName = svcUserName; client.ClientCredentials.UserName.Password = svcPassword; GetConfirmationRequest request = new GetConfirmationRequest(); GetConfirmationResponse response = new GetConfirmationResponse(); request.tradingSystemCode = pTradingSysCode; request.tradingSystemKey = pTradingSysKey; request.templateName = pTemplateName; response = client.getConfirmation(request); pDocType = response.objectFormatInd.ToString(); resultDoc = response.objectStream; return(resultDoc); }
public byte[] GetConfirm(string pTradingSysCode, string pTradingSysKey, string pTemplateName, out string pDocType) { byte[] resultDoc = null; string getDocumentUrl = baseUrlStr + @"/" + GET_DOCUMENT_URL_EXT; GetDocumentClient client = new GetDocumentClient(GET_DOCUMENT_ENDPOINT, getDocumentUrl); client.ClientCredentials.UserName.UserName = svcUserName; client.ClientCredentials.UserName.Password = svcPassword; GetConfirmationRequest request = new GetConfirmationRequest(); GetConfirmationResponse response = new GetConfirmationResponse(); request.tradingSystemCode = pTradingSysCode; request.tradingSystemKey = pTradingSysKey; request.templateName = pTemplateName; response = client.getConfirmation(request); pDocType = response.objectFormatInd.ToString(); resultDoc = response.objectStream; return resultDoc; }