/// <summary>
        /// Initializes an instance of the ConsumerSearchIHIBatchSyncClient.
        /// </summary>
        /// <param name="endpointUrl">Web service endpoint for Medicare's consumer IHI batch search service.</param>
        /// <param name="endpointConfigurationName">Endpoint configuration name for the ConsumerSearchIHIBatchSync 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="signingCert">Certificate to sign the soap message with.</param>
        /// <param name="tlsCert">Certificate for establishing TLS connection to the HI service.</param>
        /// <param name="hpio">Identifer for the organisation</param>
        private void InitializeClient(string endpointUrl, string endpointConfigurationName, X509Certificate2 signingCert, X509Certificate2 tlsCert, ProductType product, QualifiedId user, QualifiedId hpio)
        {
            Utility.SetUpMapping();

            Validation.ValidateArgumentRequired("product", product);
            Validation.ValidateArgumentRequired("user", user);
            Validation.ValidateArgumentRequired("signingCert", signingCert);
            Validation.ValidateArgumentRequired("tlsCert", tlsCert);

            this.product = product;
            this.user    = user;
            this.hpio    = hpio;

            SoapMessages = new HIEndpointProcessor.SoapMessages();

            ConsumerSearchIHIBatchSyncPortTypeClient client = null;

            if (!string.IsNullOrEmpty(endpointUrl))
            {
                EndpointAddress address    = new EndpointAddress(endpointUrl);
                CustomBinding   tlsBinding = GetBinding();

                client = new ConsumerSearchIHIBatchSyncPortTypeClient(tlsBinding, address);
            }
            else if (!string.IsNullOrEmpty(endpointConfigurationName))
            {
                client = new ConsumerSearchIHIBatchSyncPortTypeClient(endpointConfigurationName);
            }

            if (client != null)
            {
                HIEndpointProcessor.ProcessEndpoint(client.Endpoint, signingCert, SoapMessages);

                if (tlsCert != null)
                {
                    client.ClientCredentials.ClientCertificate.Certificate = tlsCert;
                }

                ihiBatchClient = client;
            }
        }
        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;
            }
        }
Exemplo n.º 3
0
        private void InitializeClient(string endpointUrl, string endpointConfigurationName, X509Certificate2 signingCert,
                                      X509Certificate2 tlsCert, ProductType clientProduct, QualifiedId clientUser)
        {
            Validation.ValidateArgumentRequired("product", clientProduct);
            Validation.ValidateArgumentRequired("user", clientUser);
            Validation.ValidateArgumentRequired("signingCert", signingCert);
            Validation.ValidateArgumentRequired("tlsCert", tlsCert);

            this.product = clientProduct;
            this.user    = clientUser;

            SoapMessages = new HIEndpointProcessor.SoapMessages();

            ProviderManageProviderDirectoryEntryPortTypeClient client = null;

            if (!string.IsNullOrEmpty(endpointUrl))
            {
                var address    = new EndpointAddress(endpointUrl);
                var tlsBinding = GetBinding();

                client = new ProviderManageProviderDirectoryEntryPortTypeClient(tlsBinding, address);
            }
            else if (!string.IsNullOrEmpty(endpointConfigurationName))
            {
                client = new ProviderManageProviderDirectoryEntryPortTypeClient(endpointConfigurationName);
            }

            if (client != null)
            {
                HIEndpointProcessor.ProcessEndpoint(client.Endpoint, signingCert, SoapMessages);

                if (tlsCert != null)
                {
                    client.ClientCredentials.ClientCertificate.Certificate = tlsCert;
                }

                providerDirectoryEntryClient = client;
            }
        }