Documentation Center

Connecting to the Core Service from Java as a different user

Connect to the Core Service as a different user if you do not want to log on as the currently logged on user.

Procedure

  1. Add the following import statement to your proxy client class:
    import javax.xml.ws.*;
  2. Connect to the server and initialize the Core Service by writing the following code:
    CoreService service = new CoreService();
    ICoreService endpoint = service.getBasicHttp();
    BindingProvider provider = (BindingProvider)client;
    provider.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "domain\\user");
    provider.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "password");
    

    where domain is the domain that contains the user you want to connect to the Core Service, user is the name of that user, and password is that user's password.