+ Start a Discussion
Diane12345Diane12345 

Conntecting with API via Proxy?

Hi!

Just developed a small application that is transfering data from
Baan to Salesforce. It's running fine here in my test environment.

However at customer site there is a proxy that has to be conntected
to get outside.
I'm not a expert for all the soap-connecting stuff and it just worked,
copying it from the samples but how do I have to change the code to
connect via a proxy?
Can someone give me a detailed (Java) code example?

Thanks a lot
Diane
udupaudupa
Hi,

Refer the following

http://forum.java.sun.com/thread.jspa?threadID=631964&tstart=0

http://forum.java.sun.com/thread.jspa?threadID=479711&messageID=2260557

http://forums.sforce.com/sforce/board/message?board.id=JAVA_development&message.id=1292&highlight=proxy+Authentication+Required#M1292


I found many forums which suggest that you set the proxy authentication using either of the following piece of code:-

System.getProperties().put( "proxySet", "true" );

System.getProperties().put( "http.proxyHost", "your proxy name/ip address" );

System.getProperties().put( "http.proxyPort", "port" );

System.getProperties().put( "http.proxyUser", "your proxy user id" );

System.getProperties().put( "http.proxyPassword", "proxy PASSWORD" );

OR

System.getProperties().put( "proxySet", "true" );

System.getProperties().put( "proxyHost", "gateway.xyz.net" ); //This is the proxy entry in the Browser.

System.getProperties().put( "proxyPort", "80" );

String password = "userid:password";

BASE64Encoder enc = new sun.misc.BASE64Encoder();

String encoded = enc.encode(password.getBytes());

connection.setRequestProperty( "Proxy-Authorization", "Basic " + encoded )


Use the first method (as I used it and it worked)......