Quick Start (SwaRef): Reinstating access to a revoked document using the web service API

The following Java web service code example reinstates access to a revoked PDF document named PolicyProtectedLoanDoc.pdf. (See Reinstating Access to Revoked Documents.)

/** 
    * Ensure that you create Java proxy files that consume 
    * the Rights Management services  WSDL. You can use JAX-WS to create 
    * the proxy Java files.   
    * 
    * For information, see "Invoking LiveCycle using SwaRef" in Programming with LiveCycle   
    */ 
import java.io.*; 
 
import javax.activation.DataHandler; 
import javax.activation.FileDataSource; 
import javax.xml.ws.BindingProvider; 
import com.adobe.idp.services.*; 
 
public class UnrevokeDocSwaRef { 
    public static void main(String[] args) { 
          try{ 
                 //Setting configurations to retrieve the LiveCycle web service 
                String url = "http://hiro-xp:8080/soap/services/RightsManagementService?blob=swaRef"; 
                String username = "administrator"; 
                String password = "password"; 
                 
                // Create the service Client objects needed 
                RightsManagementServiceService rightsManagementService = new RightsManagementServiceService(); 
                RightsManagementService rightsManagementClient = rightsManagementService.getRightsManagementService(); 
                 
                // Retrieve the Web services from the LiveCycle 
                ((BindingProvider) rightsManagementClient).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url); 
                ((BindingProvider) rightsManagementClient).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, username); 
                ((BindingProvider) rightsManagementClient).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, password); 
 
                //Reference a PDF document to reinstate     
                String path = "C:\\Adobe\PolicyProtectedLoanDoc.pdf"; 
                FileDataSource ds = new FileDataSource(path);  
                DataHandler handler = new DataHandler(ds); 
                BLOB inDoc = new BLOB(); 
                inDoc.setSwaRef(handler); 
 
                //Retrieve the license identifier of the revoked document 
                String licID = rightsManagementClient.getLicenseID(inDoc); 
 
                //Reinstate access to the revoked PDF document 
                rightsManagementClient.unrevokeLicense(licID); 
 
 
          }catch(Exception e) 
          { 
                 e.printStackTrace();  
          } 
    } 
} 
 

// Ethnio survey code removed