I am trying to access the HP ALM rest api to get the login authentication tokens using java but the rest api throws UnknownHostException.
private static final String almURL = "https://myalmUrl.com/qcbin";
private static final String isAuthenticatedPath = "authentication-point/authenticate";
public static String strUserName = "username";
public static String strPassword = "password";
private static String getEncodedAuthString() {
String auth = strUserName + ":" + strPassword;
byte[] encodedAuth = Base64.getEncoder().encode(auth.getBytes());
String authHeader = "Basic " + new String(encodedAuth);
return authHeader;
}
public static void main(String args[]) {
client = ClientBuilder.newBuilder().build();
target = client.target(almURL).path(isAuthenticatedPath);
invocationBuilder = target.request(new String[] { "application/xml" });
invocationBuilder.header("Authorization", getEncodedAuthString());
res = invocationBuilder.get(); // error occured
}
error : Exception in thread "main" javax.ws.rs.ProcessingException: java.net.UnknownHostException: myalmUrl.com
What is the problem in this code? how can i fix it?