[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

09/30/2005 at 08:33AM PDT, ID: 21579895
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.0

Making an https connection

Asked by imladris in Java Programming Language

Tags: connection

Expert gentlebeings,

I am using the following method (in a Jetty webserver) to exchange information with another webserver:

      String exchMsg(HttpResponse response,StringBuffer sb,boolean sendok)
      {      HttpURLConnection conn=null;
            try
            {      URL address=new URL("https://"+ipxml+":"+portxml);
                  conn=(HttpURLConnection)address.openConnection();
                  if(conn==null)
                  {      Log.warning("error connecting");
                        sendResp(response,"send error!");
                        return(null);
                  }
            } catch(Exception e)
            {      Log.warning("error connecting: "+e);
                  sendResp(response,"send error!");
                  return(null);
            }
            
            try
            {      conn.setRequestMethod("POST");
                  conn.setDoOutput(true);
                  conn.setDoInput(true);
                  conn.connect();
            
                  OutputStream outs=conn.getOutputStream();
                  outs.write(sb.toString().getBytes("ASCII"));
                  outs.flush();
                  outs.close();
            } catch(Exception e)
            {      Log.warning("error sending: "+e);
                  sendResp(response,"send error!");
                  return(null);
            }
            Log.event("SENT to "+ipxml+":"+portxml+" "+sb);
            if(sendok)sendResp(response,"OK");
            
            try
            {      InputStream ins=conn.getInputStream();
                  byte bs[]=new byte[1000];
                  sb=new StringBuffer(1000);
                  int n;
                  do
                  {      if((n=ins.read(bs))!=-1)sb.append(new String(bs,0,n));
                  } while(!sb.toString().endsWith("</Response>"));
                  ins.close();
            } catch(Exception e)
            {      Log.warning("error receiving: "+e);
                  return(null);
            }
            Log.event("RECV "+sb.toString());
            return(sb.toString());
      }

Now, when I was connecting to an unencrypted port, everything worked fine. However, in attempting to get it encrypted, I changed the URL to be https, connected to a different port on their end (that provides an encrypted connection), and now I get an exception in the second try/catch block, presumably at the conn.connect() statement:

08:12:51.921 WARN!! error sending: java.net.ConnectException: Connection timed out: connect

The guys at the other end indicate that I am not processing their public key, and that they don't have provision for processing a public key from us (not that I was intending to provide one), and they are getting a handshake exception:

HTTPRequestHandler.getRequestLine()javax.net.ssl.SSLHandshakeException:

Received fatal alert: certificate_unknown (HTTP Request handler) 2005-09-30 14:36:57,073 [HTTPRequest.java] DEBUG - Data has not been sent from another process, sending data... (HTTP Request handler) 2005-09-30 14:36:57,074 [HTTPResponse.java] DEBUG - Status code 400 (HTTP Request handler) 2005-09-30 14:36:57,074 [HTTPResponse.java] DEBUG - Sending standard request (HTTP Request handler) 2005-09-30 14:36:57,074 [HTTPResponse.java] DEBUG - Checking security, authorization string null (HTTP Request handler) 2005-09-30 14:36:57,075 [HTTPConst.java] DEBUG - Encoding URL: /~HTTPServerImages/notvalid.gif (HTTP Request handler) 2005-09-30 14:36:57,075 [HTTPConst.java] DEBUG - URL encoded /~HTTPServerImages/notvalid.gif (HTTP Request handler) 2005-09-30 14:36:57,076 [HTTPResponse.java] WARN - IOException:

HTTPResponse.send()javax.net.ssl.SSLException: Connection has been

shutdown: javax.net.ssl.SSLHandshakeException: Received fatal alert: certificate_unknown (HTTP Request handler) 2005-09-30 14:36:57,076


What must I do/add to get this to work?
[+][-]09/30/05 08:35 AM, ID: 14993297

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/30/05 08:36 AM, ID: 14993305

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/30/05 08:40 AM, ID: 14993344

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/30/05 09:46 AM, ID: 14993936

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/30/05 10:03 AM, ID: 14994055

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/30/05 11:06 AM, ID: 14994667

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/30/05 11:45 AM, ID: 14994987

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/30/05 12:07 PM, ID: 14995144

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/30/05 12:42 PM, ID: 14995431

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/30/05 12:50 PM, ID: 14995504

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/03/05 01:42 PM, ID: 15009712

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/03/05 01:43 PM, ID: 15009722

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/03/05 03:26 PM, ID: 15010419

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/04/05 06:38 AM, ID: 15013709

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/07/05 11:21 AM, ID: 15040869

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/07/05 11:26 AM, ID: 15040909

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/14/05 03:15 PM, ID: 15089347

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/15/05 02:56 AM, ID: 15090768

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Java Programming Language
Tags: connection
Sign Up Now!
Solution Provided By: girionis
Participating Experts: 4
Solution Grade: A
 
 
[+][-]10/15/05 07:02 AM, ID: 15091297

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/07/05 08:02 AM, ID: 15239802

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/18/05 07:49 AM, ID: 15320409

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/19/05 06:59 AM, ID: 15325923

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/30/05 09:48 AM, ID: 15390111

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/30/05 11:28 AM, ID: 15390825

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091028-EE-VQP-85