Share via


Republishing the Issuance License

After the application has the old, signed, issuance license certificate and the new, unsigned, issuance license certificate, it calls the EditIssuanceLicense method. This method creates a new issuance license chain with all the data from the new issuance license and the content key from the old issuance license.

The following C# example shows how to call EditIssuanceLicense by using a proxy. In this code, the unsigned issuance license is first converted to an XMLDocument element in order to call EditIssuanceLicense by using SOAP. The retrieved issuance license is converted from an array of XmlNode values into a string array, so that it can be stored in the container file.

public override string[] EditPublishingLicense(
       string signedPL, 
       string unsignedPL)
{
    RmsRepublishProxy.EditIssuanceLicenseParams[] _params;
    RmsRepublishProxy.EditIssuanceLicenseResponse[] _Responses;

    // Validate parameters.
    if (signedPL == null || unsignedPL == null)
        throw new ArgumentNullException();

    if (RMSHost == null)
        return null;

    // Set data for EditIssuanceLicense proxy.

    // Set URL of EditIssuanceLicense page.
    m_srvEdit.Url = RMSHost + @"/EditIssuanceLicense.asmx";

    // Set version data.
    m_srvEdit.VersionDataValue
                  = new RmsRepublishProxy.VersionData();
    m_srvEdit.VersionDataValue.MinimumVersion   
                  = DataVersionConstants.MinimumVersion;
    m_srvEdit.VersionDataValue.MaximumVersion   
                  = DataVersionConstants.MaximumVersion;

    // Attach Windows credentials to access EditIssuanceLicense.
    NetworkCredential rmsCredential  
                  = new CredentialCache().GetCredential(
                                           new Uri(m_srvEdit.Url), 
                                           "NTLM");
    if (rmsCredential == null)
        m_srvEdit.Credentials       
                  = CredentialCache.DefaultCredentials;
    else
        m_srvEdit.Credentials       
                  = rmsCredential;

    // Prepare the EditIssuanceLicense parameters.
    XmlDocument xmld = new XmlDocument();
    xmld.LoadXml(unsignedPL);

    // Load the unsigned and signed issuance licenses 
    // into the proxy parameters in XML format.
    _params     = new RmsRepublishProxy.EditIssuanceLicenseParams[1];
    _params[0]  = new RmsRepublishProxy.EditIssuanceLicenseParams();
    _params[0].UnsignedIssuanceLicense = xmld.DocumentElement;
    xmld.LoadXml(signedPL);
    _params[0].SignedIssuanceLicense    = xmld.DocumentElement;

    // Call EditIssuanceLicense synchronously.
    _Responses = m_srvEdit.EditIssuanceLicense(_params);

    // Change the XmlNode array of the returned issuance
    // license into a string array so that it can be stored. 
    // Assume that only one license was returned.
    return GetStringChainFromXmlnChain(
                         _Responses[0].CertificateChain);
}

See Also

Updating the Issuance License

Send comments about this topic to Microsoft

Build date: 3/13/2008