BingAds / BingAds-Java-SDK

Other
42 stars 48 forks source link

How to execute the API behind a proxy? #90

Closed saidatta closed 6 years ago

saidatta commented 6 years ago

Hey guys,

I am new to the Bing SDK. I am unclear on how to reach use the SDK behind a proxy?

I have tried placing these values. But it still throws me a connection timeout for the URL https://dvsrdl.api.bingads.microsoft.com...

System.setProperty("web.proxy.enabled", "true");
System.setProperty("https.proxyHost", "<proxy-host>");
System.setProperty("https.proxyPort", "3128");

This is the code snippet that tries to download the report.

.... 
mSession = new ReportingServiceManager(authorizationData);          
mSession.setStatusPollIntervalInMilliseconds(1000);         
mSession.getAuthorizationData().validate();
.....
.....
mSession.downloadFileAsync(reportingDownloadParameters, null).get(TimeoutInMilliseconds,
                    TimeUnit.MILLISECONDS);
 ...

I am using Bing SDK version - v12. and the latest Release mvn version.

and I am unclear on how the HTTPRequest library would accept my proxy to make the call. Any ideas or hints would be greatly appreciated?

qitia commented 6 years ago

Sorry there is a bug in the current java SDK with using proxy. We are working on a hot fix with highest priority and plan to release a new version before Sept 30. I will come back to this thread when there is update.

saidatta commented 6 years ago

ok.Thanks for the response. Currently, we have a workaround with setting the HTTPRequest with proxy and it passing it in ReportingServiceManager. But, It is an ugly workaround and hope the hotfix makes things more elegant

qitia commented 6 years ago

could you please share your work around as well @saidatta

qitia commented 6 years ago

@saidatta version 11.12.6.1 is released today. Could you please try this version and let me know the result? what you need to do is only: System.setProperty("https.proxyHost", "proxy-host"); System.setProperty("https.proxyPort", "3128");

saidatta commented 6 years ago

Is 11.12.6.1 released in mvn? Any ideas on how I can download it.

https://mvnrepository.com/artifact/com.microsoft.bingads/microsoft.bingads

qitia commented 6 years ago

@saidatta you are not able to using it? It is already listed in the link you pasted above. https://mvnrepository.com/artifact/com.microsoft.bingads/microsoft.bingads/11.12.6.1

saidatta commented 6 years ago

It is working now. Thanks