/// <summary> /// Performs the ReadProviderOrganisation call. /// </summary> /// <param name="request">The request used to perform the ReadProviderOrganisation.</param> /// <returns>The response returned from the ReadProviderOrganisation call.</returns> /// <exception cref="ApplicationException">Any exceptions returned from the call.</exception> public readProviderOrganisationResponse ReadProviderOrganisation(readProviderOrganisation request) { var timestamp = new TimestampType { created = DateTime.Now.ToUniversalTime(), expires = DateTime.Now.AddDays(30).ToUniversalTime(), expiresSpecified = true }; var readProviderOrganisationRequest = new readProviderOrganisationRequest( product, new SignatureContainerType(), timestamp, user, request); LastSoapRequestTimestamp = readProviderOrganisationRequest.timestamp; readProviderOrganisationResponse1 response = null; try { response = providerReadProviderOrganisationClient.readProviderOrganisation(readProviderOrganisationRequest); } catch (Exception ex) { FaultHelper.ProcessAndThrowFault <ServiceMessagesType>(ex); } if (response != null && response.readProviderOrganisationResponse != null) { return(response.readProviderOrganisationResponse); } throw new ApplicationException(Properties.Resources.UnexpectedServiceResponse); }
public void Sample() { // ------------------------------------------------------------------------------ // Set up // ------------------------------------------------------------------------------ // Obtain the certificate by serial number X509Certificate2 tlsCert = X509CertificateUtil.GetCertificate( "Serial Number", X509FindType.FindBySerialNumber, StoreName.My, StoreLocation.CurrentUser, true ); // The same certificate is used for signing the request. // This certificate will be different to TLS cert for some operations. X509Certificate2 signingCert = tlsCert; // Set up client product information (PCIN) // Values below should be provided by Medicare ProductType product = new ProductType { platform = "Your system platform (Eg. Windows XP SP3)", // Can be any value productName = "Product Name", // Provided by Medicare productVersion = "Product Version", // Provided by Medicare vendor = new QualifiedId() { id = "Vendor Id", // Provided by Medicare qualifier = "Vendor Qualifier" // Provided by Medicare } }; // Set up user identifier details QualifiedId user = new QualifiedId { id = "OMO", // The OMO of the certificate qualifier = "http://<anything>/id/<anything>/userid/1.0" // Eg: http://ns.medicareaustralia.gov.au/id/hi/distinguishedname/1.0 }; // ------------------------------------------------------------------------------ // Client instantiation and invocation // ------------------------------------------------------------------------------ // Instantiate the client var client = new ProviderReadProviderOrganisationClient( new Uri("https://HIServiceEndpoint"), product, user, signingCert, tlsCert ); // Create the request var directoryEntry = new readProviderOrganisation { hpioNumber = "http://ns.electronichealth.net.au/id/hi/hpio/1.0/" + "HPIO Number Here", linkSearchType = "link Search Type Here" }; // Submit the request try { var response = client.ReadProviderOrganisation(directoryEntry); } catch (Exception ex) { // If an error is encountered, client.LastSoapResponse often provides a more // detailed description of the error. string soapResponse = client.SoapMessages.SoapResponse; } }