I'm trying to call Webservices API using JAVA but I have connection issue probably due to a proxy.
I already did it with C# WPF application, and to avoid connection issue I set following option on App.config file
<system.net>
<defaultProxy useDefaultCredentials="true"></defaultProxy>
I don't find a way to do the same setup on JAVA and my connection is rejected :
Do you know how can I setup the default proxy ?
JAVA code
/**
* Executes the request and returns its response.
*
* @return the request's response
* @throws IOException if the underlying {@link HttpsURLConnection} could
* not be set up or executed
*/
public String execute() throws IOException {
HttpsURLConnection connection = null;
try {
connection = (HttpsURLConnection) url.openConnection();
connection.setRequestMethod("POST");
// write POST data to request
// Exception is raised at this level
if (postData != null && !postData.toString().isEmpty()) {
connection.setDoOutput(true);
try (OutputStreamWriter out = new OutputStreamWriter(connection.getOutputStream()))
{
out.write(postData.toString());
}
catch(Exception e){
System.out.println(e.getMessage());
}
}
// execute request and read response
try (BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()))) {
StringBuilder response = new StringBuilder();
String line;
while ((line = in.readLine()) != null) {
response.append(line);
}
return response.toString();
}
}
finally {
connection.disconnect();
}
}
Many thanks for your help