Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Services / Web / System / Web / Services / Protocols / XmlReturnWriter.cs / 1305376 / XmlReturnWriter.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Services.Protocols { using System.IO; using System; using System.Xml.Serialization; using System.Reflection; using System.Collections; using System.Web.Services; using System.Text; using System.Web.Services.Diagnostics; internal class XmlReturnWriter : MimeReturnWriter { XmlSerializer xmlSerializer; public override void Initialize(object o) { xmlSerializer = (XmlSerializer)o; } public override object[] GetInitializers(LogicalMethodInfo[] methodInfos) { return XmlReturn.GetInitializers(methodInfos); } public override object GetInitializer(LogicalMethodInfo methodInfo) { return XmlReturn.GetInitializer(methodInfo); } internal override void Write(HttpResponse response, Stream outputStream, object returnValue) { Encoding encoding = new UTF8Encoding(false); response.ContentType = ContentType.Compose("text/xml", encoding); StreamWriter writer = new StreamWriter(outputStream, encoding); TraceMethod caller = Tracing.On ? new TraceMethod(this, "Write") : null; if (Tracing.On) Tracing.Enter(Tracing.TraceId(Res.TraceWriteResponse), caller, new TraceMethod(xmlSerializer, "Serialize", writer, returnValue)); xmlSerializer.Serialize(writer, returnValue); if (Tracing.On) Tracing.Exit(Tracing.TraceId(Res.TraceWriteResponse), caller); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Services.Protocols { using System.IO; using System; using System.Xml.Serialization; using System.Reflection; using System.Collections; using System.Web.Services; using System.Text; using System.Web.Services.Diagnostics; internal class XmlReturnWriter : MimeReturnWriter { XmlSerializer xmlSerializer; public override void Initialize(object o) { xmlSerializer = (XmlSerializer)o; } public override object[] GetInitializers(LogicalMethodInfo[] methodInfos) { return XmlReturn.GetInitializers(methodInfos); } public override object GetInitializer(LogicalMethodInfo methodInfo) { return XmlReturn.GetInitializer(methodInfo); } internal override void Write(HttpResponse response, Stream outputStream, object returnValue) { Encoding encoding = new UTF8Encoding(false); response.ContentType = ContentType.Compose("text/xml", encoding); StreamWriter writer = new StreamWriter(outputStream, encoding); TraceMethod caller = Tracing.On ? new TraceMethod(this, "Write") : null; if (Tracing.On) Tracing.Enter(Tracing.TraceId(Res.TraceWriteResponse), caller, new TraceMethod(xmlSerializer, "Serialize", writer, returnValue)); xmlSerializer.Serialize(writer, returnValue); if (Tracing.On) Tracing.Exit(Tracing.TraceId(Res.TraceWriteResponse), caller); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TypeConverterHelper.cs
- DataGridViewBand.cs
- WebPartAddingEventArgs.cs
- XmlDataImplementation.cs
- ExpressionSelection.cs
- JsonFormatWriterGenerator.cs
- PageAsyncTask.cs
- SessionStateItemCollection.cs
- XmlSchemaImport.cs
- FixedSOMTable.cs
- Parser.cs
- HandleCollector.cs
- BasicHttpBindingCollectionElement.cs
- HwndStylusInputProvider.cs
- IndexedGlyphRun.cs
- SuppressIldasmAttribute.cs
- ByteBufferPool.cs
- BaseParser.cs
- ComponentResourceManager.cs
- BackgroundWorker.cs
- ReaderWriterLockWrapper.cs
- fixedPageContentExtractor.cs
- TextDecorationUnitValidation.cs
- XPathDocumentNavigator.cs
- RepeaterItemEventArgs.cs
- LZCodec.cs
- CompilerTypeWithParams.cs
- BlockCollection.cs
- AnimatedTypeHelpers.cs
- SHA384Managed.cs
- XmlElementList.cs
- WindowsPrincipal.cs
- ModifiableIteratorCollection.cs
- DataColumn.cs
- ScriptManager.cs
- TrustManager.cs
- TypedTableGenerator.cs
- ReferenceEqualityComparer.cs
- StringDictionaryWithComparer.cs
- HebrewCalendar.cs
- ProfileProvider.cs
- IDReferencePropertyAttribute.cs
- EFColumnProvider.cs
- SynchronizationContext.cs
- MergeFilterQuery.cs
- DoubleAnimationUsingPath.cs
- CollectionBase.cs
- RenderDataDrawingContext.cs
- SID.cs
- XmlWriterSettings.cs
- SmtpTransport.cs
- RadioButton.cs
- BooleanStorage.cs
- TreeViewBindingsEditorForm.cs
- OdbcConnectionPoolProviderInfo.cs
- ProfilePropertySettingsCollection.cs
- XmlBindingWorker.cs
- RtfToXamlReader.cs
- _HelperAsyncResults.cs
- RedirectionProxy.cs
- ShaperBuffers.cs
- ScriptResourceDefinition.cs
- Renderer.cs
- ParsedAttributeCollection.cs
- CommandPlan.cs
- CompositeFontFamily.cs
- Query.cs
- HMACRIPEMD160.cs
- HtmlInputFile.cs
- MethodAccessException.cs
- XmlSchemaElement.cs
- Drawing.cs
- CacheSection.cs
- CachedTypeface.cs
- FlowPosition.cs
- safex509handles.cs
- LocalizedNameDescriptionPair.cs
- PageThemeCodeDomTreeGenerator.cs
- GradientSpreadMethodValidation.cs
- CuspData.cs
- XmlArrayItemAttribute.cs
- CfgParser.cs
- JobPageOrder.cs
- Soap.cs
- HttpCookieCollection.cs
- CodeExpressionStatement.cs
- HttpModuleCollection.cs
- TableAutomationPeer.cs
- SemaphoreSlim.cs
- SizeAnimation.cs
- SymLanguageType.cs
- ClaimTypes.cs
- ResourceReferenceKeyNotFoundException.cs
- GlobalizationAssembly.cs
- StringArrayConverter.cs
- GridViewColumnCollection.cs
- UserPreferenceChangedEventArgs.cs
- RegularExpressionValidator.cs
- PropertyNames.cs
- HandlerBase.cs