コード例 #1
0
        private void ConfigureClient(FileStreamingClient 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
        public string Upload(byte[] fileContent)
        {
            string result = null;

            using (FileStreamingClient client = new FileStreamingClient())
            {
                ConfigureClient(client);
                try
                {
                    client.Open();
                    result = client.Upload(fileContent);
                    client.Close();
                }
                catch (Exception ex)
                {
                    client.Abort();
                    throw ex;
                }
            }
            return(result);
        }
コード例 #3
0
        public bool CheckConnection()
        {
            bool result = false;

            using (FileStreamingClient client = new FileStreamingClient())
            {
                ConfigureClient(client);
                try
                {
                    client.Open();
                    result = client.CheckConnection();
                    client.Close();
                }
                catch (Exception ex)
                {
                    client.Abort();
                    throw ex;
                }
            }
            return(result);
        }