コード例 #1
0
        public CardFilesCommunicationManager()
        {
            if (m_log.IsDebugEnabled)
            {
                m_log.DebugFormat("Creating CardFiles client");
            }

            m_serviceClient = new CardFilesServiceClient();

            if (m_serviceClient.ClientCredentials != null)
            {
                m_serviceClient.ClientCredentials.HttpDigest.ClientCredential = new NetworkCredential(UserName, UserPassword);

                m_serviceClient.ClientCredentials.HttpDigest.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation;
            }
            else
            {
                const string message = "Service client credentials not initialized";

                if (m_log.IsFatalEnabled)
                {
                    m_log.FatalFormat(message);
                }

                throw new InvalidDataException(message);
            }
        }
コード例 #2
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         // free managed resources
         if (m_serviceClient != null)
         {
             if (m_serviceClient.State == CommunicationState.Faulted)
             {
                 m_serviceClient.Abort();
             }
             else
             {
                 m_serviceClient.Close();
             }
             m_serviceClient = null;
         }
     }
 }