Quick Start (SwaRef): Revoking a document using the web service API

The following web service Java code example revokes a policy-protected document named PolicyProtectedLoanDoc.pdf. A revised PDF document is located at the following URL location http://localhost:8080/RightsManagement/UpdatedLoan.pdf. (See Revoking Access to 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 javax.activation.DataHandler; 
import javax.activation.FileDataSource; 
import javax.xml.ws.BindingProvider; 
import com.adobe.idp.services.*; 
 
public class RevokeDocSwaRef { 
    public static void main(String[] args) { 
          try{ 
                 //Setting configurations to retrieve the LiveCycle 
                String url = "http://hiro-xp:8080/soap/services/RightsManagementService?blob=swaRef"; 
                String username = "administrator"; 
                String password = "password"; 
                 
                //Create the RightsManagementServiceService object 
                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 revoke     
                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 policy-protected document 
                String licID = rightsManagementClient.getLicenseID(inDoc); 
 
                //Specify the URL to the revised document 
                String revokedURL = "http://hiro-xp:8080/RightsManagement/UpdatedLoan.pdf"; 
             
                //Revoke the document 
                rightsManagementClient.revokeLicense(licID, Reason.DOCUMENT_REVISED, revokedURL); 
             
          }catch(Exception e) 
          { 
                 e.printStackTrace();  
          } 
    } 
} 

// Ethnio survey code removed