示例#1
0
        public TrustedDocDomain Import(Guid externalDirectoryOrgId)
        {
            RmsUtil.ThrowIfGuidEmpty(externalDirectoryOrgId, "externalDirectoryOrgId");
            X509Certificate2 authenticationCertificate = this.LoadAuthenticationCertificate();

            this.ThrowIfAuthenticationCertificateIsInvalid(authenticationCertificate);
            ITenantManagementService tenantManagementService = this.CreateRmsOnlineWebServiceProxy(authenticationCertificate);
            TrustedDocDomain         result;

            try
            {
                TenantInfo[] tenantInfo = tenantManagementService.GetTenantInfo(new string[]
                {
                    externalDirectoryOrgId.ToString()
                });
                RmsUtil.ThrowIfTenantInfoisNull(tenantInfo, externalDirectoryOrgId);
                RmsUtil.ThrowIfZeroOrMultipleTenantInfoObjectsReturned(tenantInfo, externalDirectoryOrgId);
                RmsUtil.ThrowIfErrorInfoObjectReturned(tenantInfo[0], externalDirectoryOrgId);
                RmsUtil.ThrowIfTenantInfoDoesNotIncludeActiveTPD(tenantInfo[0], externalDirectoryOrgId);
                RmsUtil.ThrowIfTpdDoesNotIncludeKeyInformation(tenantInfo[0].ActivePublishingDomain, externalDirectoryOrgId);
                RmsUtil.ThrowIfTpdDoesNotIncludeSLC(tenantInfo[0].ActivePublishingDomain, externalDirectoryOrgId);
                RmsUtil.ThrowIfTpdDoesNotIncludeTemplates(tenantInfo[0].ActivePublishingDomain, externalDirectoryOrgId);
                RmsUtil.ThrowIfTenantInfoDoesNotIncludeLicensingUrls(tenantInfo[0], externalDirectoryOrgId);
                RmsUtil.ThrowIfTenantInfoDoesNotIncludeCertificationUrls(tenantInfo[0], externalDirectoryOrgId);
                this.IntranetLicensingUrl     = RMUtil.ConvertUriToLicenseLocationDistributionPoint(tenantInfo[0].LicensingIntranetDistributionPointUrl);
                this.ExtranetLicensingUrl     = RMUtil.ConvertUriToLicenseLocationDistributionPoint(tenantInfo[0].LicensingExtranetDistributionPointUrl);
                this.IntranetCertificationUrl = RMUtil.ConvertUriToLicenseLocationDistributionPoint(tenantInfo[0].CertificationIntranetDistributionPointUrl);
                this.ExtranetCertificationUrl = RMUtil.ConvertUriToLicenseLocationDistributionPoint(tenantInfo[0].CertificationExtranetDistributionPointUrl);
                result = RmsUtil.ConvertFromRmsOnlineTrustedDocDomain(tenantInfo[0].ActivePublishingDomain);
            }
            catch (FaultException <ArgumentException> innerException)
            {
                throw new ImportTpdException("Caught FaultException<ArgumentException> while obtaining TPD from RMS Online", innerException);
            }
            catch (CommunicationException innerException2)
            {
                throw new ImportTpdException("Unable to communicate with RMS Online key sharing web service", innerException2);
            }
            catch (TimeoutException innerException3)
            {
                throw new ImportTpdException("The TPD import request to the RMS Online key sharing web service has timed out", innerException3);
            }
            return(result);
        }