Пример #1
0
        private void ConfigureClient(ReferenceDataClient client)
        {
            // Load the certificate from the Project Resources.

            // Note that this certificate has been generated from the default SOLA Development keystore.jks. Instructions on how to
            // generate the cert using the Java keytool can be found here.
            // http://stackoverflow.com/questions/5529541/developing-a-net-client-that-consumes-a-secure-metro-2-1-web-service
            // Note that it is also necessary to add DNS identity configuration to the app.config. The default DNS identity in this
            // certificate is xwssecurityserver.
            X509Certificate2 cert = new X509Certificate2(org.sola.services.boundary.wsclients.Properties.Resources.ServerCertificate);

            client.ClientCredentials.ServiceCertificate.DefaultCertificate = cert;
            client.ClientCredentials.UserName.UserName = uName;
            client.ClientCredentials.UserName.Password = pWord;
        }
Пример #2
0
 communicationTypeTO[] IReferencedataService.GetCommunicationTypes()
 {
     communicationTypeTO[] result = null;
     using (ReferenceDataClient client = new ReferenceDataClient())
     {
         ConfigureClient(client);
         try
         {
             client.Open();
             result = client.GetCommunicationTypes(en);
             client.Close();
         }
         catch (Exception ex)
         {
             client.Abort();
             throw ex;
         }
         return(result);
     }
 }
Пример #3
0
        public bool CheckConnection()
        {
            bool result = false;

            using (ReferenceDataClient client = new ReferenceDataClient())
            {
                ConfigureClient(client);
                try
                {
                    client.Open();
                    result = client.CheckConnection();
                    client.Close();
                }
                catch (Exception ex)
                {
                    client.Abort();
                    throw ex;
                }
            }
            return(result);
        }
Пример #4
0
        private static async Task LoadSessionManagementReferenceDataUsingGrpc(int i, CancellationToken cancellationToken)
        {
            Stopwatch st = new Stopwatch();

            using (System.IO.StreamWriter file =
                       new System.IO.StreamWriter($@"C:\Temp\Grpc_{i}.txt"))

            {
                file.WriteLine(DateTime.Now.ToString("hh:mm:ss.fff tt"));
                st.Start();

                var channel = GrpcChannel.ForAddress("https://localhost:5001");
                var client  = new ReferenceDataClient(channel);

                SiteParameterReply response;

                response = await client.GetSiteParametersAsync(new Pulse.Grpc.ReferenceData.SiteParameterRequest {
                    Sitcd = "**", Key1 = "MTHPCD63", Key2 = ""
                });

                response = await client.GetSiteParametersAsync(new Pulse.Grpc.ReferenceData.SiteParameterRequest {
                    Sitcd = "**", Key1 = "SESSION", Key2 = ""
                });

                response = await client.GetSiteParametersAsync(new Pulse.Grpc.ReferenceData.SiteParameterRequest {
                    Sitcd = "**", Key1 = "DONOR_COMMS", Key2 = ""
                });

                response = await client.GetSiteParametersAsync(new Pulse.Grpc.ReferenceData.SiteParameterRequest {
                    Sitcd = "P1", Key1 = "MTHPCD63", Key2 = ""
                });

                response = await client.GetSiteParametersAsync(new Pulse.Grpc.ReferenceData.SiteParameterRequest {
                    Sitcd = "**", Key1 = "MTHPCD61", Key2 = ""
                });

                response = await client.GetSiteParametersAsync(new Pulse.Grpc.ReferenceData.SiteParameterRequest {
                    Sitcd = "**", Key1 = "REPORTS", Key2 = ""
                });

                response = await client.GetSiteParametersAsync(new Pulse.Grpc.ReferenceData.SiteParameterRequest {
                    Sitcd = "**", Key1 = "MTHPCD82", Key2 = "MRKTDEPTTEXT"
                });

                response = await client.GetSiteParametersAsync(new Pulse.Grpc.ReferenceData.SiteParameterRequest {
                    Sitcd = "**", Key1 = "MTHPCD63", Key2 = "SHOW_PANSUB"
                });

                //#region rptparam

                //response = await _httpClient.GetAsync("odata/rptparam?$filter=rident eq 'SESSION_TEAMREPORT' and sitcd eq '**'", cancellationToken);
                //response.EnsureSuccessStatusCode();

                //response = await _httpClient.GetAsync("odata/rptparam?$filter=rident eq 'SESSION_APPOINTMENTGRID' and sitcd eq '**'", cancellationToken);
                //response.EnsureSuccessStatusCode();

                //response = await _httpClient.GetAsync("odata/rptparam?$filter=rident eq 'SESSION_DONORAPPOINTMENTS' and sitcd eq '**'", cancellationToken);
                //response.EnsureSuccessStatusCode();

                //response = await _httpClient.GetAsync("odata/rptparam?$filter=rident eq 'SESSION_CANCEL_TRAN_FAILS' and sitcd eq '**'", cancellationToken);
                //response.EnsureSuccessStatusCode();

                //response = await _httpClient.GetAsync("odata/rptparam?$filter=rident eq 'SESSION_MANUFACTURING_DIARY' and sitcd eq '**'", cancellationToken);
                //response.EnsureSuccessStatusCode();

                //response = await _httpClient.GetAsync("odata/rptparam?$filter=rident eq 'SESSION_ROTAREPORT' and sitcd eq '**'", cancellationToken);
                //response.EnsureSuccessStatusCode();

                //response = await _httpClient.GetAsync("odata/rptparam?$filter=rident eq 'WALKIN_LIST' and sitcd eq '**'", cancellationToken);
                //response.EnsureSuccessStatusCode();

                st.Stop();
                file.WriteLine(st.Elapsed);
                file.WriteLine(st.ElapsedMilliseconds);
                file.Flush();

                //#endregion
            }
        }