Quick Start (SwaRef): Deleting a policy using the web service API

The following web service Java code example deletes a policy named Allow Copy. (See Deleting Policies.)

/** 
    * 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.xml.ws.BindingProvider; 
import com.adobe.idp.services.RightsManagementService; 
import com.adobe.idp.services.RightsManagementServiceService; 
 
public class DeletePolicySwaRef { 
    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 RightsManagementServiceService needed 
                RightsManagementServiceService rightsManagementService = new RightsManagementServiceService(); 
                RightsManagementService rightsManagementClient = rightsManagementService.getRightsManagementService(); 
                 
                //Set connection properties required to invoke 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); 
                                 
                //Delete a policy named Allow Copy 
                rightsManagementClient.deletePolicy("Global Policy Set", "Allow Copy"); 
                 
          }catch(Exception e) 
          { 
                 e.printStackTrace();  
          } 
    } 
}