OfficeDev / ews-managed-api

Other
585 stars 320 forks source link

First call from EWS is failing with error - outlook.office365.com:443 failed to respond #64

Open buddha1990 opened 9 years ago

buddha1990 commented 9 years ago

Hi, For every few minutes, when we do any EWS call (like appointment.save), call is failing with error: outlook.office365.com:443 failed to respond at microsoft.exchange.webservices.data.core.request.SimpleServiceRequestBase.internalExecute(SimpleServiceRequestBase.java:74) at microsoft.exchange.webservices.data.core.request.MultiResponseServiceRequest.execute(MultiResponseServiceRequest.java:158) at microsoft.exchange.webservices.data.core.ExchangeService.internalCreateItems(ExchangeService.java:598) at microsoft.exchange.webservices.data.core.ExchangeService.createItem(ExchangeService.java:657) at microsoft.exchange.webservices.data.core.service.item.Item.internalCreate(Item.java:245) at microsoft.exchange.webservices.data.core.service.item.Item.save(Item.java:386) Caused by: microsoft.exchange.webservices.data.core.exception.service.remote.ServiceRequestException: The request failed. outlook.office365.com:443 failed to respond at microsoft.exchange.webservices.data.core.request.ServiceRequestBase.getEwsHttpWebResponse(ServiceRequestBase.java:729) at microsoft.exchange.webservices.data.core.request.ServiceRequestBase.validateAndEmitRequest(ServiceRequestBase.java:639) at microsoft.exchange.webservices.data.core.request.SimpleServiceRequestBase.internalExecute(SimpleServiceRequestBase.java:62) ... 66 common frames omitted Caused by: org.apache.http.NoHttpResponseException: outlook.office365.com:443 failed to respond at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:143) at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57) at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:261) at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:165) at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:272) at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:124) at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:271) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184) at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88) at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82) at microsoft.exchange.webservices.data.core.request.HttpClientWebRequest.executeRequest(HttpClientWebRequest.java:292) at microsoft.exchange.webservices.data.core.request.ServiceRequestBase.getEwsHttpWebResponse(ServiceRequestBase.java:720)

Immediate next call is working fine. In case Auto discover URL is expired, it should throw different UnknownHostException.

Any clue

GhadaRV commented 2 years ago

Hello,

How did you solve this problem please?

Thanks!

MichelZ commented 2 years ago

Switch to Microsoft Graph. EWS is dead.

GhadaRV commented 2 years ago

Hoping it helps someone. I solved it by adding this line of code : exchangeService.getHttpHeaders().put("Connection","close");