OfficeDev / ews-java-api

A java client library to access Exchange web services. The API works against Office 365 Exchange Online as well as on premises Exchange.
MIT License
867 stars 558 forks source link

EWS is not working with On-premise exchange url in the cloud . #309

Open nshowkath opened 9 years ago

nshowkath commented 9 years ago

Hi,

Below is our requirement - We are implementing cloud services (Proxies ) which are wrapper to EWS JAVA API’s – We are supporting both EWS on premise and O365. O355 will work in any cloud solution but EWS on-premise does not work because cloud does not recognize On-premise host and port. To solve this problem we implement concept called Destination API in our cloud – we will configure something like https://Virtual host: Virtual Port :EWS/Exchange.asmx Our cloud destination object returns httpClientFromDestination =destination.createHttpClient(); Either We need support from EWS JAVA API Custom httpclient support like assign httpClient to EWSService

ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);

HttpClient httpClientFromDestination =destination.createHttpClient();//our destination returns httpclient
Service.SethttpClient= httpClientFromDestination;

I saw we have support something like .net EWS but will this resolve our httpClient handler problem?Do we’ve to rely on HttpClient only which is provided by Apache.

ExchangeService service = null;
service = new ExchangeService(RequestedExchangeVersion.Value);
if (SpecifyProxySettings == true)
            {
                WebProxy oWebProxy  = null;
                oWebProxy = new WebProxy(ProxyServerName, ProxyServerPort);
                oWebProxy.BypassProxyOnLocal = BypassProxyForLocalAddress;
                 ……..
             }
service.WebProxy = oWebProxy;

Thanks, Showkath.

praseodym commented 9 years ago

Why not edit your own API so that it returns the proper Exchange server URL, instead of a HttpClient object?

nshowkath commented 9 years ago

Hi , We can not edit our API , So Can you make changes in EWS Java API , one general question I have is Can other team (Non EWS Java team ) contribute to EWS Java API to fix any issues or implementing enhancements ?

serious6 commented 9 years ago

@nshowkath ews-java-api is an open source software and anyone can provide fixes via pull requests. Once reviewed every contribution has the chance to get merged. If you want more information on how to provide Contributions here see:

evpaassen commented 9 years ago

Exposing the HttpClient is not desired, as explained in #100. To be honest, this sounds like incorrect API design on your side. But if you insist on providing the HttpClient instance yourself, you could create your own fork of this library.

However, I'd think that the right long term solution would be to fix your API. Your 'virtual URL' should be resolved to a real URL before passing it to the EWS Java API.