예제 #1
0
        public override void EndProxyWebRequest(ProxyWebRequest proxyWebRequest, QueryList queryList, IService service, IAsyncResult asyncResult)
        {
            MailTipsApplication.GetMailTipsTracer.TraceFunction((long)this.traceId, "Entering MailTipsApplication.EndProxyWebRequest");
            GetMailTipsResponseMessageType getMailTipsResponseMessageType = service.EndGetMailTips(asyncResult);
            int hashCode = proxyWebRequest.GetHashCode();

            if (getMailTipsResponseMessageType == null)
            {
                Application.ProxyWebRequestTracer.TraceError((long)this.traceId, "{0}: Proxy web request returned NULL GetMailTipsResponseMessageType", new object[]
                {
                    TraceContext.Get()
                });
                queryList.SetResultInAllQueries(new MailTipsQueryResult(new NoEwsResponseException()));
                base.HandleNullResponse(proxyWebRequest);
                return;
            }
            ResponseCodeType responseCode = getMailTipsResponseMessageType.ResponseCode;

            if (responseCode != ResponseCodeType.NoError)
            {
                Application.ProxyWebRequestTracer.TraceError <object, string>((long)hashCode, "{0}: Proxy web request returned error code {1}", TraceContext.Get(), responseCode.ToString());
                queryList.SetResultInAllQueries(new MailTipsQueryResult(new ErrorEwsResponseException(responseCode)));
                return;
            }
            this.ProcessResponseMessages(hashCode, queryList, getMailTipsResponseMessageType);
        }
예제 #2
0
 public override void EndProxyWebRequest(ProxyWebRequest proxyWebRequest, QueryList queryList, IService service, IAsyncResult asyncResult)
 {
     try
     {
         GetUserPhotoResponseMessageType getUserPhotoResponseMessageType = service.EndGetUserPhoto(asyncResult);
         queryList.SetResultInAllQueries(new UserPhotoQueryResult(getUserPhotoResponseMessageType.PictureData, getUserPhotoResponseMessageType.CacheId, getUserPhotoResponseMessageType.StatusCode, getUserPhotoResponseMessageType.Expires, getUserPhotoResponseMessageType.ContentType, this.upstreamTracer));
     }
     finally
     {
         this.proxyLatencyTracker.Stop();
     }
 }
예제 #3
0
 private void ProcessResponseMessages(int traceId, QueryList queryList, GetMailTipsResponseMessageType response)
 {
     if (response.ResponseMessages == null)
     {
         Application.ProxyWebRequestTracer.TraceError((long)traceId, "{0}: Proxy web request returned NULL GetMailTipsResponseMessageType.ResponseMessages", new object[]
         {
             TraceContext.Get()
         });
         queryList.SetResultInAllQueries(new MailTipsQueryResult(new NoEwsResponseException()));
         return;
     }
     for (int i = 0; i < response.ResponseMessages.Length; i++)
     {
         MailTipsResponseMessageType mailTipsResponseMessageType = response.ResponseMessages[i];
         BaseQuery[] array = queryList.FindByEmailAddress(queryList[i].Email.Address);
         foreach (MailTipsQuery mailTipsQuery in array)
         {
             if (mailTipsResponseMessageType == null)
             {
                 Application.ProxyWebRequestTracer.TraceError <object, Microsoft.Exchange.InfoWorker.Common.Availability.EmailAddress>((long)traceId, "{0}: Proxy web request returned NULL MailTipsResponseMessageType for mailbox {1}.", TraceContext.Get(), queryList[i].Email);
                 mailTipsQuery.SetResultOnFirstCall(new MailTipsQueryResult(new NoEwsResponseException()));
             }
             else if (mailTipsResponseMessageType.ResponseCode != ResponseCodeType.NoError)
             {
                 Application.ProxyWebRequestTracer.TraceError <object, Microsoft.Exchange.InfoWorker.Common.Availability.EmailAddress, ResponseCodeType>((long)traceId, "{0}: Proxy web request returned error MailTipsResponseMessageType for mailbox {1}. Error coee is {2}.", TraceContext.Get(), queryList[i].Email, mailTipsResponseMessageType.ResponseCode);
                 mailTipsQuery.SetResultOnFirstCall(new MailTipsQueryResult(new ErrorEwsResponseException(mailTipsResponseMessageType.ResponseCode)));
             }
             else
             {
                 MailTips mailTips = mailTipsResponseMessageType.MailTips;
                 if (mailTips == null)
                 {
                     Application.ProxyWebRequestTracer.TraceDebug <object, Microsoft.Exchange.InfoWorker.Common.Availability.EmailAddress>((long)traceId, "{0}: Proxy web request returned NULL MailTips for mailbox {1}.", TraceContext.Get(), queryList[i].Email);
                     mailTipsQuery.SetResultOnFirstCall(new MailTipsQueryResult(new NoMailTipsInEwsResponseMessageException()));
                 }
                 else
                 {
                     MailTips            mailTips2         = MailTipsApplication.ParseWebServiceMailTips(mailTips);
                     MailTipsQueryResult resultOnFirstCall = new MailTipsQueryResult(mailTips2);
                     mailTipsQuery.SetResultOnFirstCall(resultOnFirstCall);
                 }
             }
         }
     }
 }