-
Notifications
You must be signed in to change notification settings - Fork 47
Description
Please find the code below and help resolving the error.
Error: Exception in thread "main" javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
at sun.security.ssl.SSLSessionImpl.getPeerCertificates(SSLSessionImpl.java:440)
at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:126)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:437)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180)
at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:643)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
at org.apache.http.impl.client.DecompressingHttpClient.execute(DecompressingHttpClient.java:137)
at org.apache.http.impl.client.DecompressingHttpClient.execute(DecompressingHttpClient.java:108)
at com.rallydev.rest.client.HttpClient.executeRequest(HttpClient.java:157)
at com.rallydev.rest.client.HttpClient.doRequest(HttpClient.java:145)
at com.rallydev.rest.client.ApiKeyClient.doRequest(ApiKeyClient.java:37)
at com.rallydev.rest.client.HttpClient.doGet(HttpClient.java:221)
at com.rallydev.rest.RallyRestApi.query(RallyRestApi.java:172)
at rallySample.GetAllUsers.main(GetAllUsers.java:29)
import com.google.gson.JsonObject;
import com.rallydev.rest.RallyRestApi;
import com.rallydev.rest.request.QueryRequest;
import com.rallydev.rest.response.QueryResponse;
import com.rallydev.rest.util.Fetch;
import java.net.URI;
public class GetAllUsers {
public static void main(String[] args) throws Exception {
String host = "https://rally1.rallydev.com";
String apiKey = "apikey";
String applicationName = "get all users";
RallyRestApi restApi = null;
try {
restApi = new RallyRestApi(new URI(host),apiKey);
restApi.setProxy(new URI("https://proxy.xyz.com:8080"),"","");
QueryRequest request = new QueryRequest("User");
restApi.setApplicationName(applicationName);
request.setFetch(new Fetch(new String[] {"UserName"}));
request.setLimit(1000);
QueryResponse response = restApi.query(request);
System.out.println("TotalResultCount: " + response.getTotalResultCount());
for (int i=0; i<response.getTotalResultCount();i++){
JsonObject userJsonObject = response.getResults().get(i).getAsJsonObject();
System.out.println("Name: " + userJsonObject.get("UserName"));
}
} finally {
if (restApi != null) {
restApi.close();
}
}
}
}