Return-Path: Delivered-To: apmail-jakarta-httpclient-user-archive@www.apache.org Received: (qmail 85247 invoked from network); 29 Jul 2005 13:19:14 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 29 Jul 2005 13:19:14 -0000 Received: (qmail 99488 invoked by uid 500); 29 Jul 2005 13:19:13 -0000 Delivered-To: apmail-jakarta-httpclient-user-archive@jakarta.apache.org Received: (qmail 99471 invoked by uid 500); 29 Jul 2005 13:19:13 -0000 Mailing-List: contact httpclient-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: "HttpClient User Discussion" Reply-To: "HttpClient User Discussion" Delivered-To: mailing list httpclient-user@jakarta.apache.org Received: (qmail 99453 invoked by uid 99); 29 Jul 2005 13:19:13 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Jul 2005 06:19:13 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [206.135.58.111] (HELO smtp) (206.135.58.111) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 29 Jul 2005 06:19:05 -0700 Received: from Nilo ([192.168.45.8]) by smtp (JAMES SMTP Server 2.2.0) with SMTP ID 586 for ; Fri, 29 Jul 2005 09:19:11 -0400 (EDT) Message-ID: <11110670.1122643296709.JavaMail.root@Nilo> Date: Fri, 29 Jul 2005 09:21:36 -0400 (EDT) From: Michael Clovis Reply-To: Michael Clovis To: HttpClient User Discussion Subject: Re: Re: Re: SSL with Certificate In-Reply-To: <20050729124915.GA31682@uml24.umlhosting.ch> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: jwma X-MessageIsInfected: false X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Oleg, I pass in the host name and Servlet "constant" that maps to URI we use in server.xml.. but thanks to the "long - distance" proof reading of my code found what I think is the problem.. Programmer who worked for me had hardcoded using a stringBuffer http:// to beginning of server name.. inside of this class. my duh! Thanks for your help and all your great work! Will fix it and try some more. ---------- Original Message ---------- Date: 7/29/05 From: Oleg Kalnichevski To: httpclient-user@jakarta.apache.org Subject: Re: Re: SSL with Certificate >Michael, what is the value of servletPath? > >Oleg > > >On Fri, Jul 29, 2005 at 08:46:21AM -0400, Michael Clovis wrote: >> >> Oleg thanks in advance.. >> >> This is from the class that extends HttpClient.. all methods prepare servlet request >first like so.. >> >> >> public boolean authorizeIS(){ >> NameValuePair[] form_data = new NameValuePair[8]; >> form_data[0] = new NameValuePair("sourceid", SOURCE_ID); //APPLICATION ID >> form_data[1] = new NameValuePair("destid", DEST_ID); //DEST ID >> form_data[2] = new NameValuePair("requesttype",BULKLOADERSESSIONID_REQ); //TYPE >OF REQUEST >> form_data[3] = new NameValuePair("requestid", "111"); //ID OF THE REQUEST >> form_data[4] = new NameValuePair("username",isUser); //USER ID >> form_data[5] = new NameValuePair("password",isPass); //PASSWORD >> form_data[6] = new NameValuePair("sent",Long.toString(System.currentTimeMillis())); >> form_data[7] = new NameValuePair("ntlmlogin",ntlmlogin); >> >> StringBuffer servBuff = new StringBuffer(servletPath); >> servBuff.append("?sourceid=").append(SOURCE_ID).append("&destid=").append(DEST_ID); >> //System.out.println(servBuff.toString()); >> >> ReqResult reqRes = this.sendRequest(servBuff.toString(), form_data, "Session"); >> if(reqRes == null){ >> System.out.println("Requested Result is null"); >> //writeErrLog("Request Result was null", SERVLET_ERR); >> return false; >> } >> >> System.out.println("Request result: " + reqRes.isAccepted()); >> >> if(reqRes.isAccepted()){ >> this.sessionID = reqRes.getSessionId(); >> this.isAdmin = reqRes.isAdmin(); >> System.out.println("SESSION ID: " + this.sessionID); >> System.out.println("UserAdmin: "+isAdmin); >> }else{ >> writeErrLog(reqRes.getErrorMessage(),Integer.parseInt(reqRes.getErrorCode())); >> return false; >> } >> >> return true; >> } >> >> ... sendRequest is where PostMethod is executed as follows... >> >> >> protected ReqResult sendRequest(String host, NameValuePair[] data, String resultType) >{ >> PostMethod post = new PostMethod(host); >> post.addParameters(data); >> try { >> return sendRequest(post, resultType); >> } catch (Exception e) { >> this.writeErrException(e); >> e.printStackTrace(); >> //throw e; >> return null; >> } >> >> } >> >> protected ReqResult sendRequest(ExpectContinueMethod post, String resultType){ >> ReqResult reqResult = null; >> post.setDoAuthentication(true); >> try{ >> this.executeMethod(post); >> >> //handle any errors that'll come down the pipe >> if(post.getStatusCode() >= 300){ >> writeErrLog(post.getStatusLine().getReasonPhrase(), post.getStatusCode()); >> return null; >> } >> >> String responseBody = new String(post.getResponseBodyAsString()); >> System.out.println(responseBody); >> reqResult = new ReqResult(responseBody, resultType); >> >> }catch(HttpException hte){ >> this.writeErrException(hte); >> hte.printStackTrace(); >> }catch(IOException ioe){ >> this.writeErrException(ioe); >> ioe.printStackTrace(); >> } >> catch(Exception e){ >> this.writeErrException(e); >> e.printStackTrace(); >> } >> return reqResult; >> } >> >> I again appreciate in advance your insight! >> >> >> ---------- Original Message ---------- >> Date: 7/29/05 >> From: Oleg Kalnichevski >> To: httpclient-user@jakarta.apache.org >> Subject: Re: SSL with Certificate >> >> >Michael, >> > >> >Could you please post a code snippet showing how the HttpMethod is >> >instantiated and executed? >> > >> >Oleg >> > >> > >> >On Thu, Jul 28, 2005 at 05:52:30PM -0400, Michael Clovis wrote: >> >> I am maintaining an application that is using HTTPClient 2.0.2 and one clas= >> >> s extends HttpClient in particular ( one reason for not upgrading to 3x). N= >> >> eed to support SSL and have started to test code using self-signed certs. M= >> >> ade sure through Apache the servlet the application accesses can not be acc= >> >> essed other than through SSL and wire info reads that the header informatio= >> >> n can be seen yet when method is sent to servlet get a 401. Furthermore doi= >> >> ng tcpdumps reveal app never ran on port 443 but port 80. Am using simple p= >> >> aradigm (as in example code) of : >> >> >> >> StrictSSLProtocolSocketFactory sf =3D new StrictSSLProtocolSocketFactory()= >> >> ; >> >> =20 >> >> >> >> Protocol stricthttps =3D new Protocol( "https", sf, 443); >> >> Protocol.registerProtocol("https",stricthttps); >> >> // du is client instance du.getHostConfiguration().setHost(this.hostname.ge= >> >> tText().trim(),443,stricthttps) >> >> >> >> >> > >> >--------------------------------------------------------------------- >> >To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org >> >For additional commands, e-mail: httpclient-user-help@jakarta.apache.org >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org >> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org >> >> > >--------------------------------------------------------------------- >To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org >For additional commands, e-mail: httpclient-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: httpclient-user-help@jakarta.apache.org