code: public String login( String username, String password ) throws DebugWsException {
  
  		this.logger.finer( "Logging in as " + username );
  		WebResource path = this.resource.path( UrlConstants.AUTHENTICATION ).path( "e" );
  		ClientResponse response = path
  						.header( "u", username )
  						.header( "p", password )
  						.post( ClientResponse.class );
  
  		if( Family.SUCCESSFUL != response.getStatusInfo().getFamily()) {
  			String value = response.getEntity( String.class );
  			this.logger.finer( response.getStatusInfo() + ": " + value );
  			throw new DebugWsException( response.getStatusInfo().getStatusCode(), value );
  		}
  
  		// Get the session ID from the cookie that should have been returned
  		String sessionId = null;
  		List<NewCookie> cookies = response.getCookies();
  		if( cookies != null ) {
  			for( NewCookie cookie : cookies ) {
  				if( UrlConstants.SESSION_ID.equals( cookie.getName())) {
  					sessionId = cookie.getValue();
  					break;
  				}
  			}
  		}
  
  		// Set the session ID
  		this.wsClient.setSessionId( sessionId );
  		this.logger.finer( "Session ID: " + sessionId );
  
  		return sessionId;
  	}
docs: Logs in with a user name and a password.
  @param username a user name
  @param password a password
  @return a session ID, or null if login failed
  @throws DebugWsException