From my applicaiton we need to access an external url for mail servcice.we will have to establish the connection with this server and POST the values to this server. The external Server URL is in HTTPS, and requires a basic authentication.
the code is given below. I am getting error :java.net.ConnectException: Tried all: 1 addresses, but could not connect over HTTPS to server: "domainname" port: 443
java.net.URL url = new URL("https:\\domainname\...\index.php"); HttpsURLConnection connection = new HttpsURLConnection(url); String userNamePassword="username assword"; String encoding= new BASE64Encoder().encodeBuffer userNamePassword.getBytes()); connection.setRequestProperty("Authorization","Basic "+encoding); connection.setTimeout(wom_connection_timeout); connection.setRequestMethod("POST"); connection.setUseCaches(false); connection.setDoOutput(true);
Can any body suggest a way to connect to a Server through https url and pass the post variables?
[ October 30, 2008: Message edited by: nishad km ] [ October 30, 2008: Message edited by: nishad km ]
Joined: Mar 22, 2005
You aren't really using "domainname" as the server name, are you?
Is the server reachable by HTTP from the machine this code runs on?