System.Xml.XmlWriter
{
EwsLogging_1.EwsLogging.Assert(writer != null, "ExchangeServiceBase.DoOnSerializeCustomSoapHeaders", "writer is null");
if (this.OnSerializeCustomSoapHeaders != null) {
this.OnSerializeCustomSoapHeaders(writer);
}
};
ExchangeServiceBase.prototype.InternalProcessHttpErrorResponse = function (httpWebResponse, webException, responseHeadersTraceFlag, responseTraceFlag) { throw new Error("ExchangeServiceBase.ts - InternalProcessHttpErrorResponse : Not implemented."); };
ExchangeServiceBase.prototype.IsTraceEnabledFor = function (traceFlags) { return this.TraceEnabled && ((this.TraceFlags & traceFlags) != 0); };
ExchangeServiceBase.prototype.PrepareHttpWebRequestForUrl = function (url, acceptGzipEncoding, allowAutoRedirect) {
// Verify that the protocol is something that we can handle
if ((url.Scheme != Uri_1.Uri.UriSchemeHttp) && (url.Scheme != Uri_1.Uri.UriSchemeHttps)) {
throw new ServiceLocalException_1.ServiceLocalException("unsupported web protocol" + url); //string.Format(Strings.UnsupportedWebProtocol, url.Scheme));
}
var request = { url: url.ToString() };
request.headers = {};
//request.PreAuthenticate = this.PreAuthenticate;
//request.Timeout = this.Timeout; //todo: implement this within IPromise
this.SetContentType(request);
request.type = "POST";
//request.headers["User-Agent"] = this.UserAgent || ExchangeServiceBase.defaultUserAgent; //todo:fix -> Noje.js is refusing to set this unsafe header -//
//request.AllowAutoRedirect = allowAutoRedirect;
//todo: figure out next 3 lines
//request.CookieContainer = this.CookieContainer;
//request.KeepAlive = this.keepAlive;
//request.ConnectionGroupName = this.connectionGroupName;
if (acceptGzipEncoding) {
request.headers["Accept-Encoding"] = "gzip,deflate";
}
if (!ExtensionMethods_1.StringHelper.IsNullOrEmpty(this.clientRequestId)) {
request.headers["client-request-id"] = this.clientRequestId;
if (this.returnClientRequestId) {
request.headers["return-client-request-id"] = "true";
}
}
//if (this.webProxy != null) {
// request.Proxy = this.webProxy;
//}
if (this.HttpHeaders) {
for (var kv in this.HttpHeaders) {
request.headers[kv] = this.HttpHeaders[kv];
}
}
//request.UseDefaultCredentials = this.UseDefaultCredentials;
if (!this.UseDefaultCredentials) {
var serviceCredentials = this.Credentials;
if (serviceCredentials == null) {
throw new ServiceLocalException_1.ServiceLocalException(Strings_1.Strings.CredentialsRequired);
}
// Make sure that credentials have been authenticated if required
//serviceCredentials.PreAuthenticate(); //todo: fix preauthenticate if possible
// Apply credentials to the request
serviceCredentials.PrepareWebRequest(request);
}
else
debugger;
this.httpResponseHeaders = {};
return request;
};
ExchangeServiceBase.prototype.ProcessHttpErrorResponse = function (httpWebResponse
IEwsHttpWebResponse
webException) { throw new Error("ExchangeServiceBase.ts - ProcessHttpErrorResponse : Not implemented."); };
ExchangeServiceBase.prototype.ProcessHttpResponseHeaders = function (traceType, response) {
return;
//todo: implement tracing
this.TraceHttpResponseHeaders(traceType, response);
this.SaveHttpResponseHeaders(response.Headers);
};
ExchangeServiceBase.prototype.SaveHttpResponseHeaders = function (headers
System.Net.WebHeaderCollection
{
//debug:
this.httpResponseHeaders = {};
for (var key in headers.headers) {
this.httpResponseHeaders[key] = headers.headers[key];
}
if (this.OnResponseHeadersCaptured != null) {
this.OnResponseHeadersCaptured(headers);
}
};
ExchangeServiceBase.prototype.SetContentType = function (request
IEwsHttpWebRequest
{
request.headers["Content-Type"] = "text/xml; charset=utf-8";
request.headers["Accept"] = "text/xml";
};
ExchangeServiceBase.prototype.SetCustomUserAgent = function (userAgent) { };
ExchangeServiceBase.prototype.TraceHttpRequestHeaders = function (traceType, request) { throw new Error("ExchangeServiceBase.ts - TraceHttpRequestHeaders : Not implemented."); };
ExchangeServiceBase.prototype.TraceHttpResponseHeaders = function (traceType, response) { throw new Error("ExchangeServiceBase.ts - TraceHttpResponseHeaders : Not implemented."); };
ExchangeServiceBase.prototype.TraceMessage = function (traceType, logEntry) { EwsLogging_1.EwsLogging.Log(logEntry);
throw new Error("Not implemented.");
};
ExchangeServiceBase.prototype.TraceXml = function (traceType, stream) { throw new Error("ExchangeServiceBase.ts - TraceXml : Not implemented."); };
ExchangeServiceBase.prototype.Validate = function () { };
ExchangeServiceBase.AccountIsLocked = 456;
return ExchangeServiceBase;
})();
exports.ExchangeServiceBase = ExchangeServiceBase;