abhinavguptas/tolerado-sfdc-wsc-apis

Add ability to specify proxy server for ToleradoPartnerStub

Opened this issue · 5 comments

What steps will reproduce the problem?
1. Create new ToleradoPartnerStub from within a proxy-protected corporate 
network

What is the expected output? What do you see instead?
I would expect a successful partner stub authentication, but connection times 
out because there is no direct path to the WS URLs

What version of the product are you using? On what operating system?
1.1.1 and 20 on Windows 7 and Eclipse Helios V2.

Thanks,
Scott

Original issue reported on code.google.com by sc...@mccrory.us on 18 Apr 2011 at 6:49

Note then when using straight WSC, you can establish proxy settings with the 
following code:

        System.getProperties().put("http.proxyHost", proxyHost);
        System.getProperties().put("http.proxyPort", proxyPort);
        if (partnerConfig != null) {
            partnerConfig.setProxy(proxyHost, proxyPort);
        }

Original comment by sc...@mccrory.us on 19 Apr 2011 at 4:49

I'd love it if someone could add this feature - if I'm right, anyone operating 
behind a proxy will find it very difficult to adopt Tolerado vs. building their 
own WSC wrapper.

Original comment by sc...@mccrory.us on 9 May 2011 at 5:58

Obviously this should be added to the core code, but since I'm not a committer 
yet and needed a workaround tonight, I worked out how to do this myself. It's 
easy, though unfortunately not as simple as just overriding 
prepareConnectorConfig because of the way the classes are designed.

- Using subclipse, download the whole source tree of Tolerado as a new project. 
It should just magically compile right away.
- In your target project that is using Tolerado, remove the Tolerado jar's you 
were previously referring to, and replace the dependency with an eclipse 
project dependency on the tolerado project you just created.
- In ToleradoStub.java in the Tolerado project, simply edit the 
prepareConnectorConfig method to add the line 

cfg.setProxy(yourHost, yourPort); // obviously replace the yourHost and 
yourPort with your proxy values.

- In EnterpriseLoginWSMethod, similarly add this line to the second line of 
invokeActual:

entConfig.setProxy(yourHost, yourPort); // obviously replace the yourHost and 
yourPort with your proxy values.

- You should be all set. At least I was. Hope this helps.

Original comment by jkrayb...@gmail.com on 12 May 2011 at 7:44

Brilliant JK!  I may need to revisit a decision to not use Tolerado yesterday.  
Wasn't sure if anyone was out there...

Original comment by sc...@mccrory.us on 12 May 2011 at 2:50

Yeah, you should probably use it. It really simplifies your WS client code, and 
the source is easy to deal with. If you don't use it, you'll end up writing 
your own thin wrappers to do basically the same stuff it's doing anyway.

Original comment by jkrayb...@gmail.com on 12 May 2011 at 11:34