hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bashiro"<bash...@myway.com>
Subject Re: GET PROBLEMS! ALTERNATIVE
Date Wed, 06 Feb 2008 18:51:56 GMT

Hello folks,

Ifound out that when I put the whole update string into my browser;
 https://dynupdate.no-ip.com/nic/update?hostname=bashiro.no-ip.org&myip=1.2.3.4
The password popup comes and when I put my user and pass it works.

Now is there a way to put the string into httpclient and bypass the get method ?

example:

client.getState().setCredentials(
               new AuthScope("update String above", 443, "DDNS"),

and how can I set the Get ? Because right after the password the responds code appears. Now
how do i let httpclient read the response bypassing the GET ?

Thanks
bashiro


Bashiro
Drammen-Norway

 --- On Tue 02/05, Joshua Preston < joshua.preston@tfcci.com > wrote:
From: Joshua Preston [mailto: joshua.preston@tfcci.com]
To: httpclient-users@hc.apache.org
Date: Tue, 5 Feb 2008 18:00:16 -0500
Subject: Re: GET PROBLEMS!

Basically, don't use https, try http without SSL.  If the error goes  away, you'll need to
add no-ip's CA or certificate to your trusted  keystore.  Google can provide 100s of examples
of adding/replacing to  a trusted keystore.Sent from my iPhoneOn Feb 5, 2008, at 4:27 PM,
Bashiro <bashiro@myway.com> wrote:>> Thanks joshua,> I have tried that and
I get this error;>> javax.net.ssl.SSLHandshakeException:  > sun.security.validator.ValidatorException:
No trusted certificate  > found>    at com.sun.net.ssl.internal.ssl.BaseSSLSocketImpl.a(DashoA6275)>
   at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)>    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)>
   at com.sun.net.ssl.internal.ssl.SunJSSE_az.a(DashoA6275)>    at com.sun.net.ssl.internal.ssl.SunJSSE_az.a(DashoA6275)>
   at com.sun.net.ssl.internal.ssl.SunJSSE_ax.a(DashoA6275)>    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)>
   at 
com.sun.net.ssl.internal.ssl.SSLSocketImpl.j(DashoA6275)> "    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)>
   at com.sun.net.ssl.internal.ssl.AppOutputStream.write(DashoA6275)>    at java.io.BufferedOutputStream.flushBuffer
> (BufferedOutputStream.java:66)>    at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:
> 124)>    at  > org.apache.commons.httpclient.HttpConnection.flushRequestOutputStream
> (HttpConnection.java:825)>    at org.apache.commons.httpclient.HttpMethodBase.writeRequest
> (HttpMethodBase.java:1967)>    at org.apache.commons.httpclient.HttpMethodBase.execute
> (HttpMethodBase.java:993)>    at  > org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry
> (HttpMethodDirector.java:393)>    at org.apache.commons.httpclient.HttpMethodDirector.executeMethod
> (HttpMethodDirector.java:168)>    at org.apache.commons.httpclient.HttpClient.executeMethod
> (HttpClient.java:393)>    at 
org.apache.commons.httpclient.HttpClient.executeMethod > (HttpClient.java:324)>    at
NoIpTest.main(NoIpTest.java:51)> Caused by: sun.security.validator.ValidatorException:
No trusted  > certificate found>    at sun.security.validator.SimpleValidator.buildTrustedChain
> (SimpleValidator.java:304)>    at sun.security.validator.SimpleValidator.engineValidate
> (SimpleValidator.java:107)>    at sun.security.validator.Validator.validate(Validator.java:202)>
   at  > com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted > (DashoA6275)>
   at  > com.sun.net.ssl.internal.ssl.JsseX509TrustManager.checkServerTrusted > (DashoA6275)>
   ... 17 more>>> do you think there might be something wrong with the site ? Or
am I  > missing to add suns cert?> you could just try that code on your side for me,
using anything as  > username and pass to see if> you get the same error ? If you do
not have an acount you will get  > "badauth" as return.>> Thanks> bashiro>>>
Bashiro> 
Drammen-Norway>> --- On Tue 02/05, Joshua Preston < joshua.preston@tfcci.com >
wrote:> From: Joshua Preston [mailto: joshua.preston@tfcci.com]> To: bashiro@myway.com>
    Cc: httpclient-users@hc.apache.org> Date: Tue, 05 Feb 2008 15:55:52 -0500> Subject:
Re: GET PROBLEMS!>> Bashiro,According to their spec, you should probably be using  >
something similarto (keep in mind that I don't have an account with  > no-ip):        import
java.net.URLEncoder;                import  > org.apache.commons.httpclient.HttpClient;
       import  > org.apache.commons.httpclient.UsernamePasswordCredentials;         >
import org.apache.commons.httpclient.auth.AuthScope;        import  > org.apache.commons.httpclient.methods.GetMethod;
               / > **         * NoIpTest         *          * javac  > NoIpTest.java
        * java NoIpTest myhostname 1.2.3.4          > *          * or take modify the source
accordingly....          > */        public class NoIpTest {            static final 
String enc  > = "UTF-8";            static final String username =  > "myusername";
           static final String password =  > "mypassword";            static final String
BASE_URI = "https://dynupdate.no-ip.com/nic/update > ";            static String hostname
=  > "mytest.testdomain.com";            static String IP = "1.2.3.4";>>>    
         public static void main(String[] args)  > {                // if arg 1 is hostname
and arg 2 is  > ip                if ( args.length == 2 )  > {                    hostname
= args[0];                    IP = args > [1];                }                       
HttpClient client = new  > HttpClient();                        GetMethod get = new GetMethod
> (getRequestURI());                        client.getState > ().setCredentials(   
                    new AuthScope > ("dynupdate.no-ip.com", 443, "realm"),            
           new  > UsernamePasswordCredentials(username,  > password));             
          
get.setDoAuthentication > (true);                        try {                    // execute
 > method and possibly handle any error responses                     > int status =
client.executeMethod(get);                     > System.out.println("HTTP Status: " + 
> status);                            // Get and print the  > result               
    String result = get.getResponseBodyAsString > ();                    System.out.println(result);
               }  > catch (Exception e) {                    // Catch any exceptions and
 > print the stack trace>> e.printStackTrace();                } finally  > {
                   // Release the connection                     > get.releaseConnection
> ();                }            }                    private static  > String getRequestURI()
{                return BASE_URI + "?" +  > "hostname=" + URLEncoder.encode(hostname, 
> enc)                        + "&myip=" + URLEncoder.encode(IP,  > enc);      
     }        }On 
Tue, 2008-02-05 at 15:25 -0500,  > Bashiro wrote:> > > Thanks for the reply.>
I have already tried yur  > suggestion before sending the> mail to this forum (but did
not  > work).> Here is the link to the site's specification I am trying to  > >
connect to:> http://www.no-ip.com/integrate/request> > check it  > your self and
see what might be wrong there....> Bashiro> Drammen- > Norway> >  --- On Tue
02/05, Joshua Preston <  > joshua.preston@tfcci.com > wrote:> From: Joshua Preston
[mailto: joshua.preston@tfcci.com > ]> To: bashiro@myway.com>      Cc: httpclient-users@hc.apache.org>
 > Date: Tue, 05 Feb 2008 14:36:13 -0500> Subject: Re: GET PROBLEMS!> >> Bashiro,Please
see: http://hc.apache.org/httpclient-3.x/methods/get.htmlBasically > , you aren't using
a valid URI, seehttp://en.wikipedia.org/wiki/ > Uniform_Resource_Identifier, as you'remissing
the protocol and  > hostname...>From the Javadocs,GetMethod(String uri)            >
Constructor specifying a URI.Format it 
like,GetMethod get =  > newGetMethod("http://myhost.mydomain.local/nic/update?hostname=mytest.testdomain.com&myip=1.2.3.4
> ");Thanks!On Tue, 2008-02-05 at 14:28 -0500, Bashiro wrote:> Hello  > folks,>
> I first connect to a site and then make a GET request.> >  > after authentication
the site has a GET request code as;> > /nic/ > update?hostname=mytest.testdomain.com&myip=1.2.3.4
HTTP/1.0> > when  > I put> GetMethod get = new GetMethod("/nic/update? > hostname=mytest.testdomain.com&myip=1.2.3.4");>
> I get the  > following erros;> host parameter is null;> > > where am I
going  > wrong ? or why is httpclient not able to handle this ?> > Thanks for  >
any help> > bashiro> > >> _______________________________________________>
No banners. No pop- > ups. No kidding.> Make My Way  your home on the Web - http://www.myway.com
> > > > >  > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-users- > unsubscribe@hc.apache.org> 
For additional commands, e-mail: httpclient-users-help@hc.apache.org > > > > _______________________________________________>
No banners.  > No pop-ups. No kidding.> Make My Way  your home on the Web - http://www.myway.com
> > > > >  > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-users- > unsubscribe@hc.apache.org> For
additional commands, e-mail: httpclient-users-help@hc.apache.org > >>> _______________________________________________>
No banners. No pop-ups. No kidding.> Make My Way  your home on the Web - http://www.myway.com>>>>
---------------------------------------------------------------------> To unsubscribe,
e-mail: httpclient-users-unsubscribe@hc.apache.org> For additional commands, e-mail: httpclient-users-help@hc.apache.org>---------------------------------------------------------------------To
unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.orgFor additional commands, e-mail:

httpclient-users-help@hc.apache.org

_______________________________________________
No banners. No pop-ups. No kidding.
Make My Way  your home on the Web - http://www.myway.com



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message