Ejemplo n.º 1
0
        public override IService CreateService(WebServiceUri webServiceUri, TargetServerVersion targetVersion, RequestType requestType)
        {
            Service service = new Service(webServiceUri);

            service.RequestServerVersionValue         = new RequestServerVersion();
            service.RequestServerVersionValue.Version = VersionConverter.GetRdExchangeVersionType(service.ServiceVersion);
            return(service);
        }
Ejemplo n.º 2
0
        public override IService CreateService(WebServiceUri webServiceUri, TargetServerVersion targetVersion, RequestType requestType)
        {
            Service service = new Service(webServiceUri);

            if (targetVersion >= TargetServerVersion.E14R3OrLater || targetVersion == TargetServerVersion.Unknown)
            {
                this.SetTimeZoneDefinitionHeader(service);
            }
            return(service);
        }
Ejemplo n.º 3
0
 public override IService CreateService(WebServiceUri webServiceUri, TargetServerVersion targetVersion, RequestType requestType)
 {
     switch (requestType)
     {
     case RequestType.Local:
     case RequestType.IntraSite:
     case RequestType.CrossSite:
         return(this.CreateRestService(webServiceUri));
     }
     return(this.CreateSoapService(webServiceUri));
 }
Ejemplo n.º 4
0
        public override IService CreateService(WebServiceUri webServiceUri, TargetServerVersion targetVersion, RequestType requestType)
        {
            Service service = new Service(webServiceUri);

            service.RequestServerVersionValue = new RequestServerVersion();
            if (targetVersion >= TargetServerVersion.E15)
            {
                service.RequestServerVersionValue.Version = ExchangeVersionType.Exchange2012;
            }
            else
            {
                this.mailTipTypes &= ~MailTipTypes.Scope;
                service.RequestServerVersionValue.Version = ExchangeVersionType.Exchange2010;
            }
            return(service);
        }
Ejemplo n.º 5
0
 public override IService CreateService(WebServiceUri webServiceUri, TargetServerVersion targetVersion, RequestType requestType)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 6
0
        internal ProxyWebRequest(Application application, ClientContext clientContext, RequestType requestType, RequestLogger requestLogger, QueryList queryList, TargetServerVersion targetVersion, ProxyAuthenticator proxyAuthenticator, WebServiceUri webServiceUri, UriSource source) : base(application, clientContext, requestLogger, "ProxyWebRequest")
        {
            this.proxyAuthenticator = proxyAuthenticator;
            this.url         = webServiceUri.Uri.OriginalString;
            this.protocol    = webServiceUri.Protocol;
            this.source      = source;
            this.queryList   = queryList;
            this.requestType = requestType;
            this.service     = application.CreateService(webServiceUri, targetVersion, requestType);
            if (proxyAuthenticator.AuthenticatorType == AuthenticatorType.WSSecurity || proxyAuthenticator.AuthenticatorType == AuthenticatorType.OAuth)
            {
                if (webServiceUri.ServerVersion >= Globals.E15Version && clientContext.RequestSchemaVersion >= ExchangeVersionType.Exchange2012)
                {
                    this.service.RequestServerVersionValue = new RequestServerVersion
                    {
                        Version = ExchangeVersionType.Exchange2012
                    };
                }
                else
                {
                    this.service.RequestServerVersionValue = new RequestServerVersion
                    {
                        Version = ExchangeVersionType.Exchange2009
                    };
                }
            }
            else if (targetVersion >= TargetServerVersion.E15 && clientContext.RequestSchemaVersion == ExchangeVersionType.Exchange2012)
            {
                this.service.RequestServerVersionValue = new RequestServerVersion
                {
                    Version = ExchangeVersionType.Exchange2012
                };
            }
            this.service.CookieContainer  = new CookieContainer();
            this.service.requestTypeValue = new RequestTypeHeader();
            if (requestType == RequestType.CrossSite || requestType == RequestType.IntraSite)
            {
                if (Configuration.BypassProxyForCrossSiteRequests)
                {
                    this.service.Proxy = new WebProxy();
                }
                this.service.requestTypeValue.RequestType = ProxyRequestType.CrossSite;
                if (requestType == RequestType.CrossSite)
                {
                    this.failedCounter = PerformanceCounters.CrossSiteCalendarFailuresPerSecond;
                    this.averageProcessingTimeCounter     = PerformanceCounters.AverageCrossSiteFreeBusyRequestProcessingTime;
                    this.averageProcessingTimeCounterBase = PerformanceCounters.AverageCrossSiteFreeBusyRequestProcessingTimeBase;
                    this.requestStatisticsType            = RequestStatisticsType.CrossSiteProxy;
                }
                else
                {
                    this.failedCounter = PerformanceCounters.IntraSiteProxyFreeBusyFailuresPerSecond;
                    this.averageProcessingTimeCounter     = PerformanceCounters.AverageIntraSiteProxyFreeBusyRequestProcessingTime;
                    this.averageProcessingTimeCounterBase = PerformanceCounters.AverageIntraSiteProxyFreeBusyRequestProcessingTimeBase;
                    this.requestStatisticsType            = RequestStatisticsType.IntraSiteProxy;
                }
            }
            else
            {
                bool flag = false;
                if (Configuration.BypassProxyForCrossForestRequests)
                {
                    this.service.Proxy = new WebProxy();
                    flag = true;
                }
                this.service.requestTypeValue.RequestType = ProxyRequestType.CrossForest;
                if (requestType == RequestType.FederatedCrossForest)
                {
                    if (proxyAuthenticator.AuthenticatorType == AuthenticatorType.OAuth)
                    {
                        this.failedCounter = PerformanceCounters.FederatedByOAuthFreeBusyFailuresPerSecond;
                        this.averageProcessingTimeCounter     = PerformanceCounters.AverageFederatedByOAuthFreeBusyRequestProcessingTime;
                        this.averageProcessingTimeCounterBase = PerformanceCounters.AverageFederatedByOAuthFreeBusyRequestProcessingTimeBase;
                        this.requestStatisticsType            = RequestStatisticsType.OAuthProxy;
                        this.service.requestTypeValue         = null;
                    }
                    else
                    {
                        this.failedCounter = PerformanceCounters.FederatedFreeBusyFailuresPerSecond;
                        this.averageProcessingTimeCounter     = PerformanceCounters.AverageFederatedFreeBusyRequestProcessingTime;
                        this.averageProcessingTimeCounterBase = PerformanceCounters.AverageFederatedFreeBusyRequestProcessingTimeBase;
                        this.requestStatisticsType            = RequestStatisticsType.FederatedProxy;
                    }
                    if (!flag)
                    {
                        Server localServer = LocalServerCache.LocalServer;
                        if (localServer != null && localServer.InternetWebProxy != null)
                        {
                            ProxyWebRequest.ProxyWebRequestTracer.TraceDebug <object, Uri>((long)this.GetHashCode(), "{0}: Using custom InternetWebProxy {1}", TraceContext.Get(), localServer.InternetWebProxy);
                            this.service.Proxy = new WebProxy(localServer.InternetWebProxy);
                        }
                    }
                }
                else
                {
                    this.failedCounter = PerformanceCounters.CrossForestCalendarFailuresPerSecond;
                    this.averageProcessingTimeCounter     = PerformanceCounters.AverageCrossForestFreeBusyRequestProcessingTime;
                    this.averageProcessingTimeCounterBase = PerformanceCounters.AverageCrossForestFreeBusyRequestProcessingTimeBase;
                    this.requestStatisticsType            = RequestStatisticsType.CrossForestProxy;
                }
            }
            if (!Configuration.DisableGzipForProxyRequests)
            {
                this.service.EnableDecompression = true;
            }
            string address = this.queryList[0].Email.Address;

            ProxyWebRequest.ProxyWebRequestTracer.TraceDebug <object, string, WebServiceUri>((long)this.GetHashCode(), "{0}: Adding Anchor Mailbox Header {1} to the request to {2}.", TraceContext.Get(), address, webServiceUri);
            this.service.HttpHeaders.Add("X-AnchorMailbox", address);
            if (!string.IsNullOrEmpty(base.ClientContext.RequestId))
            {
                this.service.HttpHeaders.Add("client-request-id", base.ClientContext.RequestId);
            }
        }
Ejemplo n.º 7
0
 public abstract IService CreateService(WebServiceUri webServiceUri, TargetServerVersion targetVersion, RequestType requestType);
Ejemplo n.º 8
0
 public GetFolderAndProxyRequest(Application application, InternalClientContext clientContext, RequestType requestType, RequestLogger requestLogger, QueryList queryList, TargetServerVersion targetVersion, ProxyAuthenticator proxyAuthenticator, WebServiceUri webServiceUri) : base(application, clientContext, requestType, requestLogger, queryList)
 {
     this.targetVersion      = targetVersion;
     this.proxyAuthenticator = proxyAuthenticator;
     this.webServiceUri      = webServiceUri;
 }