private void InitializeClient(string endpointUrl, string endpointConfigurationName, X509Certificate2 signingCert, X509Certificate2 tlsCert, ProductType product, QualifiedId user, QualifiedId hpio) { Validation.ValidateArgumentRequired("product", product); Validation.ValidateArgumentRequired("user", user); Validation.ValidateArgumentRequired("signingCert", signingCert); Validation.ValidateArgumentRequired("tlsCert", tlsCert); _product = product; _user = user; _hpio = hpio; SoapMessages = new HIEndpointProcessor.SoapMessages(); ProviderManageProviderOrganisationPortTypeClient client = null; if (!string.IsNullOrEmpty(endpointUrl)) { EndpointAddress address = new EndpointAddress(endpointUrl); CustomBinding tlsBinding = GetBinding(); client = new ProviderManageProviderOrganisationPortTypeClient(tlsBinding, address); } else if (!string.IsNullOrEmpty(endpointConfigurationName)) { client = new ProviderManageProviderOrganisationPortTypeClient(endpointConfigurationName); } if (client != null) { HIEndpointProcessor.ProcessEndpoint(client.Endpoint, signingCert, SoapMessages); if (tlsCert != null) { client.ClientCredentials.ClientCertificate.Certificate = tlsCert; } client.Open(); providerSearchForProviderOrganisationClient = client; } }
/// <summary> /// Initializes an instance of the provider client. /// </summary> /// <param name="endpointConfigurationName">Endpoint configuration name for the provider endpoint.</param> /// <param name="product">PCIN (generated by Medicare) and platform name values.</param> /// <param name="user">Identifier for the application that is calling the service.</param> /// <param name="hpio">Identifier for the organisation</param> /// <param name="signingCert">Certificate to sign the soap message with.</param> /// <param name="tlsCert">Certificate for establishing TLS connection to the service.</param> public ProviderManageProviderOrganisationClient(string endpointConfigurationName, ProductType product, QualifiedId user, QualifiedId hpio, X509Certificate2 signingCert, X509Certificate2 tlsCert) { Validation.ValidateArgumentRequired("endpointConfigurationName", endpointConfigurationName); InitializeClient(null, endpointConfigurationName, signingCert, tlsCert, product, user, hpio); }
/// <summary> /// Initializes an instance of the provider client. /// </summary> /// <param name="endpointUri">Web service endpoint for service.</param> /// <param name="product">PCIN (generated by Medicare) and platform name values.</param> /// <param name="user">Identifier for the application that is calling the service.</param> /// <param name="hpio">Identifier for the organisation</param> /// <param name="signingCert">Certificate to sign the soap message with.</param> /// <param name="tlsCert">Certificate for establishing TLS connection to the service.</param> public ProviderManageProviderOrganisationClient(Uri endpointUri, ProductType product, QualifiedId user, QualifiedId hpio, X509Certificate2 signingCert, X509Certificate2 tlsCert) { Validation.ValidateArgumentRequired("endpointUri", endpointUri); InitializeClient(endpointUri.ToString(), null, signingCert, tlsCert, product, user, hpio); }