hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <ROLWE...@de.ibm.com>
Subject Re: Port problem
Date Sat, 10 Sep 2005 15:14:44 GMT
Hello Thom,

could you tell us about the value of the "url" variable?
Is it an absolute URL like http://where.ever:3642/path/,
or a relative one?

cheers,
  Roland




Thom Hehl <thom@nowhereatall.com> 
10.09.2005 14:34
Please respond to
"HttpClient User Discussion"


To
HttpClient User Discussion <httpclient-user@jakarta.apache.org>
cc

Subject
Port problem






I need to communicate with HTTP port 3642 for a given session. Here's 
the code I'm using to create my client:

        //create a singular HttpClient object
        Client = new HttpClient();

        //establish a connection within 5 seconds
        Client.getHttpConnectionManager().
            getParams().setConnectionTimeout(TIMEOUT);
        Client.getHostConfiguration().setHost(Host, Port, "http");
        HttpClientParams parms=Client.getParams();
        parms.setBooleanParameter(HttpMethodParams.SINGLE_COOKIE_HEADER, 
true);
        parms.setCookiePolicy(CookiePolicy.RFC_2109);

Now I create my get and send it...

    public InputStream get(String url, NameValuePair[] parms)
        throws heavyweight.Exception
    {
        GetMethod method = new GetMethod(url);

        method.setQueryString(parms);

        //execute the method
        InputStream responseBody = null;
        Client.executeMethod(method);
        responseBody = method.getResponseBodyAsStream();

The problem is that when I do this, it appears to be opening port 80. 
Here's a portion of the log:

2005/09/10 08:24:18:542 EDT [DEBUG] DefaultHttpParams - Set parameter 
http.connection.timeout = 5000
2005/09/10 08:24:18:592 EDT [DEBUG] DefaultHttpParams - Set parameter 
http.protocol.single-cookie-header = true
2005/09/10 08:24:18:592 EDT [DEBUG] DefaultHttpParams - Set parameter 
http.protocol.cookie-policy = rfc2109
865  [main] DEBUG heavyweight.io.CgiProcessor  - 
http://orgmeta.xmlsweb.com/xmlsos/xml/v5/login.asp
865 [main] DEBUG heavyweight.io.CgiProcessor  - 
http://orgmeta.xmlsweb.com/xmlsos/xml/v5/login.asp
866  [main] DEBUG heavyweight.io.CgiProcessor  - 
http://orgmeta.xmlsweb.com/http://orgmeta.xmlsweb.com/xmlsos/xml/v5/login.asp

866 [main] DEBUG heavyweight.io.CgiProcessor  - 
http://orgmeta.xmlsweb.com/http://orgmeta.xmlsweb.com/xmlsos/xml/v5/login.asp

*2005/09/10 08:24:18:870 EDT [DEBUG] HttpConnection - Open connection to 
orgmeta.xmlsweb.com:80*
2005/09/10 08:24:23:343 EDT [DEBUG] header - >> "GET 
/http://orgmeta.xmlsweb.com/xmlsos/xml/v5/login.asp?org_id=nors&userid=AGT4&password=pics44&app=xmlsphoto


HTTP/1.1[\r][\n]"

It is trying to connect on port 80 anyway and I haven't found any way to 
tell it to use a specifc port on an HttpMethod. Can someone give me some 
guidance on this, please?

Thanks.

-- 
"In every revolution, there is one man with a vision."--Jerome Bixby

Thom Hehl
<A href="www.heavyweightsoftware.com"> www.heavyweightsoftware.com</A>


---------------------------------------------------------------------
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


Mime
View raw message