/// <summary> /// Performs the SOAP and HTTP logging. /// </summary> /// <param name="service">The SOAP service.</param> /// <param name="soapResponse">The SOAP response xml.</param> /// <param name="soapRequest">The SOAP request xml.</param> private void PerformLogging(AdsClient service, string soapRequest, string soapResponse) { if (service == null || service.User == null || soapRequest == null || soapResponse == null) { return; } bool isFailure = service.LastResponse != null && service.LastResponse is HttpWebResponse && (service.LastResponse as HttpWebResponse).StatusCode == HttpStatusCode.InternalServerError; LogEntry logEntry = new LogEntry(config, dateTimeProvider); logEntry.LogRequestDetails(service.LastRequest, soapRequest, GetFieldsToMask(), new SoapTraceFormatter()); logEntry.LogResponseDetails(service.LastResponse, soapResponse, new HashSet <string>(), new DefaultBodyFormatter()); logEntry.LogRequestSummary(service.LastRequest, GetSummaryRequestLogs(soapRequest)); logEntry.LogResponseSummary(isFailure, GetSummaryResponseLogs(soapResponse)); logEntry.Flush(); ContextStore.AddKey("FormattedSoapLog", logEntry.DetailedLog); ContextStore.AddKey("FormattedRequestLog", logEntry.SummaryLog); }
/// <summary> /// Performs the SOAP and HTTP logging. /// </summary> /// <param name="service">The SOAP service.</param> /// <param name="soapResponse">The SOAP response xml.</param> /// <param name="soapRequest">The SOAP request xml.</param> private void PerformLogging(AdsClient service, string soapRequest, string soapResponse) { if (service == null || service.User == null || soapRequest == null || soapResponse == null) { return; } bool isFailure = service.LastResponse != null && service.LastResponse is HttpWebResponse && (service.LastResponse as HttpWebResponse).StatusCode == HttpStatusCode.InternalServerError; LogEntry logEntry = new LogEntry(config, dateTimeProvider); logEntry.LogRequestDetails(service.LastRequest, soapRequest, GetFieldsToMask(), new SoapTraceFormatter()); logEntry.LogResponseDetails(service.LastResponse, soapResponse, new HashSet<string>(), new DefaultBodyFormatter()); logEntry.LogRequestSummary(service.LastRequest, GetSummaryRequestLogs(soapRequest)); logEntry.LogResponseSummary(isFailure, GetSummaryResponseLogs(soapResponse)); logEntry.Flush(); ContextStore.AddKey("FormattedSoapLog", logEntry.DetailedLog); ContextStore.AddKey("FormattedRequestLog", logEntry.SummaryLog); }