The following code Java web service example deletes a user
named Wendy Blue from LiveCycle. (See Deleting Users.)
/**
* Ensure that you create Java proxy files that
* are required to send a LiveCycle process
* an attachment using SwaRef.
*
* For information, see "Invoking LiveCycle using SwaRef" in Programming with LiveCycle.
*/
import javax.xml.ws.BindingProvider;
import com.adobe.idp.services.*;
import java.util.*;
public class DeleteUserSwaRef {
public static void main(String[] args) {
try
{
//Set connection values required to invoke LiveCycle using swaref
String url = "http://hiro-xp:8080/soap/services/DirectoryManagerService?blob=swaref" ;
String username = "administrator";
String password = "password";
//Create a DirectoryManagerServiceService object
DirectoryManagerServiceService userManager = new DirectoryManagerServiceService();
DirectoryManagerService dmClient = userManager.getDirectoryManagerService();
//Set authentication values
((BindingProvider)dmClient).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);
((BindingProvider)dmClient).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, username);
((BindingProvider)dmClient).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, password);
//Create a PrincipalSearchFilter to find the user to delete
PrincipalSearchFilter psf = new PrincipalSearchFilter();
psf.setUserId("wblue");
//Create a List and iterate through the list
MyArrayOfPrincipal map = dmClient.findPrincipalsWithFilter(psf);
List users = map.getItem();
Iterator<Object> pit = users.iterator();
if(pit.hasNext()){
//Get the user that corresponds to the user id value
User theUser = (User)pit.next();
//Delete the user
dmClient.deleteLocalUser(theUser.getOid());
}
}catch (Exception e) {
e.printStackTrace();
}
}
}
|
|
|