I am using oVirt Java SDK 3.4.2 to connect to RHEV-M environment. The code being used is

org.ovirt.engine.sdk.Api api = new Api("https://HOST:PORT/api","USER","PASSWORD", true);

The response from the server to this call is

oVirt API error <html><head><title>JBoss Web/7.2.2.Final-redhat-1 - JBWEB000064: Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>JBWEB000065: HTTP Status 401 - </h1><HR size="1" noshade="noshade"><p><b>JBWEB000309: type</b> JBWEB000067: Status report</p><p><b>JBWEB000068: message</b> <u></u></p><p><b>JBWEB000069: description</b> <u>JBWEB000121: This request requires HTTP authentication.</u></p><HR size="1" noshade="noshade"><h3>JBoss Web/7.2.2.Final-redhat-1</h3></body></html>

The documentation talks about the 401 error when the request doesn't contain "Authorization" header.

Even when i access https://HOST:PORT/api , i am prompted to login, but the credentials used to login to
https://HOST:PORT/webadmin/webadmin/WebAdmin.html don't work. So if i login to webadmin console first, then since the "Authorization" header is set, access to /api is now possible in the browser.

I need help here specifically for making the Java SDK work with RHeVM server.

-Vikas