Proxy Server when making API calls

Anonymous
Not applicable

Proxy Server when making API calls

Hi,

I downloaded marketo-soap-sdk-2.7.jar to make API calls. The problem is that our servers are behind the firewall and they don't allow to communicate with outside service without passing proxy information.

I know my proxy information, but I can't find any way to pass it to your classes so that they use it.

Can you please let me know how to pass the proxy information in API calls..

Thanks,

Ken
Tags (1)
3 REPLIES 3
SanfordWhiteman
Level 10 - Community Moderator

Re: Proxy Server when making API calls

Been awhile since I've used Java, but IIRC Java's proxy settings are sysprops.  That is, you don't have to pass them to constructors or methods, you can set them globally.  See https://developers.google.com/gdata/articles/proxy_setup, for example.
Anonymous
Not applicable

Re: Proxy Server when making API calls

Hi Sanford, 

Thank you for your response, however this will make all connections in the server pass through that proxy which is not something that I want (internal communications, etc.). 

Does you know if Marketo itself has proxy support?

Thanks,
Ken
SanfordWhiteman
Level 10 - Community Moderator

Re: Proxy Server when making API calls

@Ken C You're not actually fixing the proxy for all connections as you would if you started the JVM that way.  You're still making the changes at runtime and can reset the proxy settings afterward (controlling for multithreading of course).

Alternately you could implement proxySelector as at http://docs.oracle.com/javase/1.5.0/docs/guide/net/proxies.html.

I don't think the Marketo Java bundle has any special support for proxies, so you have to extend it.  You can search the source code if you're not sure!