XmlReturnWriter.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / untmp / 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.


                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK