ws-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hannes Wallnoefer <han...@helma.at>
Subject Re: Connections through a HTTP proxy
Date Wed, 13 Feb 2002 15:17:22 GMT
Yes, I think we should add a method with your code for setting the HTTP 
proxy to XmlRpcClient.

System.setProperty() is a static method and it sets the property for the 
whole runtime, so it won't be possible to set the proxy per client 
instance. I would propose to add a static method

  public static void setHttpProxy (String host, int port, String auth)

to XmlRpcClient.

Hannes


Martin Skopp wrote:

> Thanks for the solution Olivier,
>
> but on the other hand - shouldn't your "XmlRpcClientPlus" class 
> somehow go into the release?
>
> IMHO, XmlRpcClient should offer those proxy-settings via Constructor - 
> if it's not on the "Commit" list for development already, it should 
> urgently go there, 'cause I can imagine it's frequently needed...
>
> Cheers,
> Martin
>
> At 14:05 13.02.2002 +0000, Olivier Sarrat wrote:
>
>>> I'm trying to connect from RPC client to RPC server through a HTTP 
>>> proxy
>>> for 2 reasons:
>>>
>>>         Properties properties = System.getProperties();
>>>         properties.setProperty("proxyHost", "http://localhost");
>>>         properties.setProperty("proxyPort", "8080");
>>>         properties.setProperty("proxySet", "true");
>>>         ...
>>
>> The problem is that you have to deal not only with system properties 
>> in order to go through a firewall. You have to add the login/password 
>> to the connection object itself... which means you have to go inside 
>> the implementation of the client.
>>
>> The way I did it, is by adding so very few lines at the good place of 
>> the XmlRpcClient.Worker :
>>
>> System.setProperty("http.proxySet","true");
>> System.setProperty("http.proxyHost",proxyHost);
>> System.setProperty("http.proxyPort",proxyPort);
>> con.setRequestProperty ("Proxy-Authorization",proxyAuthorization);
>>
>> with proxyAuthorization being :
>> proxyAuthorization = "Basic " + new sun.misc.BASE64Encoder
>> ().encode((user + ":" + password).getBytes());
>>
>> and con, the UrlConnection object.
>
>
>
>
>
> Martin Skopp





Mime
View raw message