We need you! We're working hard on the next version of Developer Fusion -
Let us know what you think we should be up to!
-
Expand
Microsoft.Win32
-
Expand
Microsoft.Win32.SafeHandles
-
Expand
System
-
Expand
System.Runtime.Hosting
-
Expand
System.Runtime.InteropServices
-
Expand
System.Runtime.CompilerServices
-
Expand
System.Collections
-
Expand
System.Collections.Generic
-
Expand
System.Collections.ObjectModel
-
Expand
System.Configuration.Assemblies
-
Expand
System.Diagnostics
-
Expand
System.Diagnostics.CodeAnalysis
-
Expand
System.Diagnostics.SymbolStore
-
Expand
System.Globalization
-
Expand
System.IO
-
Expand
System.IO.IsolatedStorage
-
Expand
System.Reflection
-
Expand
System.Reflection.Cache
-
Expand
System.Reflection.Emit
-
Expand
System.Resources
-
Expand
System.Runtime
-
Expand
System.Runtime.InteropServices.Expando
-
Expand
System.Runtime.ConstrainedExecution
-
Expand
System.Runtime.Remoting.Activation
-
Expand
System.Runtime.Remoting.Messaging
-
Expand
System.Runtime.Remoting.Channels
-
Expand
ADAsyncWorkItem
-
Expand
AggregateDictionary
-
Expand
AsyncCopyStreamResult
-
Expand
AsyncMessageHelper
-
Expand
AsyncWorkItem
-
Expand
BaseChannelObjectWithProperties
-
Expand
BaseChannelSinkWithProperties
-
Expand
BaseChannelWithProperties
-
Expand
BaseTransportHeaders
-
Expand
BaseTransportHeadersEnumerator
-
Expand
BasicAsyncResult
-
Expand
BinaryClientFormatterSink
-
Expand
BinaryClientFormatterSinkProvider
-
Expand
BinaryServerFormatterSink
-
Expand
BinaryServerFormatterSinkProvider
-
Expand
CachedSocket
-
Expand
CachedSocketList
-
Expand
ChannelDataStore
-
Expand
ChannelServices
-
Expand
ChannelServicesData
-
Expand
ChunkedMemoryStream
-
Expand
ClientChannelSinkStack
-
Expand
CommonTransportKeys
-
Expand
CoreChannel
-
AppendProviderToClientProviderChain(IClientChannelSinkProvider, IClientChannelSinkProvider)
-
BufferPool()
-
CleanupUrlBashingForIisSslIfNecessary(bool)
-
CollectChannelDataFromServerSinkProviders(ChannelDataStore, IServerChannelSinkProvider)
-
CreateBinaryFormatter(bool, bool)
-
CreateSoapFormatter(bool, bool)
-
DebugException(string, Exception)
-
DebugMessage(IMessage)
-
DebugOut(string)
-
DebugOutXMLStream(Stream, string)
-
DebugStream(Stream)
-
DecodeMachineName(string)
-
DeserializeBinaryRequestMessage(string, Stream, bool, TypeFilterLevel)
-
DeserializeBinaryResponseMessage(Stream, IMethodCallMessage, bool)
-
DeserializeMessage(string, Stream, bool, IMessage)
-
DeserializeMessage(string, Stream, bool, IMessage, Header)
-
DeserializeSoapRequestMessage(Stream, Header, bool, TypeFilterLevel)
-
DeserializeSoapResponseMessage(Stream, IMessage, Header, bool)
-
DetermineChannelProtocol(IChannel)
-
GetHostName()
-
GetMachineAddress(IPHostEntry, AddressFamily)
-
GetMachineIp()
-
GetMachineName()
-
GetMessagePropertiesAsSoapHeader(IMessage)
-
GetResourceString(string)
-
GetSoapHeaders(IMessage)
-
InitResourceManager()
-
IsLocalIpAddress(IPAddress)
-
IsLocalIpAddress(IPHostEntry, AddressFamily, IPAddress)
-
MimeTypeToFormatter(string, bool)
-
RemoveApplicationNameFromUri(string)
-
ReportUnknownProviderConfigProperty(string, string)
-
RequestQueue()
-
SerializeBinaryMessage(IMessage, bool)
-
SerializeBinaryMessage(IMessage, Stream, bool)
-
SerializeMessage(string, IMessage, bool)
-
SerializeMessage(string, IMessage, Stream, bool)
-
SerializeSoapMessage(IMessage, bool)
-
SerializeSoapMessage(IMessage, Stream, bool)
-
SetupUrlBashingForIisSslIfNecessary()
-
VerifyNoProviderData(string, ICollection)
-
Expand
CrossAppDomainChannel
-
Expand
CrossAppDomainData
-
Expand
CrossAppDomainSerializer
-
Expand
CrossAppDomainSink
-
Expand
CrossContextChannel
-
Expand
DictionaryEnumeratorByKeys
-
Expand
DispatchChannelSink
-
Expand
DispatchChannelSinkProvider
-
Expand
ExclusiveTcpListener
-
Expand
IAuthorizeRemotingConnection
-
Expand
IChannel
-
Expand
IChannelDataStore
-
Expand
IChannelReceiver
-
Expand
IChannelReceiverHook
-
Expand
IChannelSender
-
Expand
IChannelSinkBase
-
Expand
IClientChannelSink
-
Expand
IClientChannelSinkProvider
-
Expand
IClientChannelSinkStack
-
Expand
IClientFormatterSink
-
Expand
IClientFormatterSinkProvider
-
Expand
IClientResponseChannelSinkStack
-
Expand
ISecurableChannel
-
Expand
IServerChannelSink
-
Expand
IServerChannelSinkProvider
-
Expand
IServerChannelSinkStack
-
Expand
IServerFormatterSinkProvider
-
Expand
IServerResponseChannelSinkStack
-
Expand
ITransportHeaders
-
Expand
MemoryChunk
-
Expand
NativeMethods
-
Expand
Perf_Contexts
-
Expand
Protocol
-
Expand
Protocol
-
Expand
RegisteredChannel
-
Expand
RegisteredChannelList
-
Expand
RemoteConnection
-
Expand
RemotingProfilerEvent
-
Expand
RequestQueue
-
Expand
ServerAsyncReplyTerminatorSink
-
Expand
ServerChannelSinkStack
-
Expand
ServerProcessing
-
Expand
SinkChannelProtocol
-
Expand
SinkProviderData
-
Expand
SinkStack
-
Expand
SinkStack
-
Expand
SoapClientFormatterSink
-
Expand
SoapClientFormatterSinkProvider
-
Expand
SoapServerFormatterSink
-
Expand
SoapServerFormatterSinkProvider
-
Expand
SocketCache
-
Expand
SocketCachePolicy
-
Expand
SocketHandler
-
Expand
SocketStream
-
Expand
StreamHelper
-
Expand
StringHelper
-
Expand
TokenInformationClass
-
Expand
TransportHeaders
-
Expand
UriHeaderHandler
-
Expand
System.Runtime.Remoting.Lifetime
-
Expand
System.Runtime.Remoting
-
Expand
System.Runtime.Remoting.Contexts
-
Expand
System.Runtime.Remoting.Proxies
-
Expand
System.Runtime.Remoting.Metadata
-
Expand
System.Runtime.Remoting.Metadata.W3cXsd2001
-
Expand
System.Runtime.Remoting.Services
-
Expand
System.Runtime.Serialization
-
Expand
System.Runtime.Serialization.Formatters
-
Expand
System.Runtime.Serialization.Formatters.Binary
-
Expand
System.Runtime.Versioning
-
Expand
System.Security
-
Expand
System.Security.Cryptography
-
Expand
System.Security.Cryptography.X509Certificates
-
Expand
System.Security.Permissions
-
Expand
System.Security.Policy
-
Expand
System.Security.Principal
-
Expand
System.Security.Util
-
Expand
System.Text
-
Expand
System.Threading
-
Expand
System.Runtime.Remoting.Channels.Http
-
Expand
System.Runtime.Remoting.Channels.Tcp
-
Expand
System.Runtime.Remoting.MetadataServices
-
Expand
System.Runtime.Serialization.Formatters.Soap.Xml
-
Expand
System.Runtime.Serialization.Formatters.Soap
-
Expand
Microsoft.Tools.Caspol
-
Expand
Microsoft.Tools.Build
-
Expand
Microsoft.CSharp
-
Expand
System.CodeDom
-
Expand
System.CodeDom.Compiler
-
Expand
System.Collections.Specialized
-
Expand
System.ComponentModel
-
Expand
System.ComponentModel.Design
-
Expand
System.ComponentModel.Design.Serialization
-
Expand
System.Configuration
-
Expand
System.Web
-
Expand
System.Configuration.Provider
-
Expand
System.Configuration.Internal
-
Expand
System.Internal
-
Expand
System.Windows.Forms
-
Expand
System.Net
-
Expand
System.Net.Sockets
-
Expand
System.Net.NetworkInformation
-
Expand
System.Net.ComImports
-
Expand
System.Net.Security
-
Expand
System.Net.Cache
-
Expand
System.Net.Configuration
-
Expand
System.Text.RegularExpressions
-
Expand
System.Tools
-
Expand
System.IO.Compression
-
Expand
System.IO.Ports
-
Expand
System.Security.AccessControl
-
Expand
System.Xml
-
Expand
System.Xml.XPath.DataBinding
-
Expand
System.Xml.Schema
-
Expand
System.Xml.Serialization
-
Expand
System.Xml.Serialization.Advanced
-
Expand
System.Xml.Serialization.Configuration
-
Expand
System.Xml.XPath
-
Expand
System.Xml.Xsl
-
Expand
System.Xml.Xsl.IlGen
-
Expand
System.Xml.Xsl.Qil
-
Expand
System.Xml.Xsl.Runtime
-
Expand
System.Xml.Xsl.XPath
-
Expand
System.Xml.Xsl.Xslt
-
Expand
System.Xml.Xsl.XsltOld
-
Expand
System.Xml.Xsl.XsltOld.Debugger
-
Expand
Microsoft.JScript
-
Expand
Microsoft.Vsa
-
Expand
Microsoft.JScript.Vsa
- using System;
- using System.Text;
- using System.Threading;
- using System.Reflection;
- using System.Runtime.Serialization;
- using System.Runtime.Serialization.Formatters;
- using System.Runtime.Serialization.Formatters.Soap;
- using System.Runtime.Serialization.Formatters.Binary;
- using System.Runtime.Remoting;
- using System.Runtime.Remoting.Channels;
- using System.Runtime.Remoting.Messaging;
- using System.Runtime.Remoting.Metadata;
- using System.Security.Principal;
- using System.ComponentModel;
- using System.IO;
- using System.Net;
- using System.Collections;
- using System.Net.Sockets;
- using System.Resources;
- using System.Diagnostics;
- using System.Globalization;
- using System.Runtime.InteropServices;
- namespace System.Runtime.Remoting.Channels
- {
-
-
-
- internal enum SinkChannelProtocol
- {
- Http,
-
- Other
- }
-
-
-
- static internal class CoreChannel
- {
- private static IByteBufferPool _bufferPool = new ByteBufferPool(10, 4096);
- private static RequestQueue _requestQueue = new RequestQueue(8, 4, 250);
-
- static internal IByteBufferPool BufferPool {
- get { return _bufferPool; }
- }
- static internal RequestQueue RequestQueue {
- get { return _requestQueue; }
- }
-
-
- internal const int MaxStringLen = 512;
-
- internal const string SOAPMimeType = "text/xml";
- internal const string BinaryMimeType = "application/octet-stream";
-
- internal const string SOAPContentType = "text/xml; charset=\"utf-8\"";
-
- private static string s_hostName = null;
- private static string s_MachineName = null;
- private static string s_MachineIp = null;
- private static IPAddress s_MachineIpAddress = null;
-
- internal const int CLIENT_MSG_GEN = 1;
- internal const int CLIENT_MSG_SINK_CHAIN = 2;
- internal const int CLIENT_MSG_SER = 3;
- internal const int CLIENT_MSG_SEND = 4;
- internal const int SERVER_MSG_RECEIVE = 5;
- internal const int SERVER_MSG_DESER = 6;
- internal const int SERVER_MSG_SINK_CHAIN = 7;
- internal const int SERVER_MSG_STACK_BUILD = 8;
- internal const int SERVER_DISPATCH = 9;
- internal const int SERVER_RET_STACK_BUILD = 10;
- internal const int SERVER_RET_SINK_CHAIN = 11;
- internal const int SERVER_RET_SER = 12;
- internal const int SERVER_RET_SEND = 13;
- internal const int SERVER_RET_END = 14;
- internal const int CLIENT_RET_RECEIVE = 15;
- internal const int CLIENT_RET_DESER = 16;
- internal const int CLIENT_RET_SINK_CHAIN = 17;
- internal const int CLIENT_RET_PROPAGATION = 18;
- internal const int CLIENT_END_CALL = 19;
- internal const int TIMING_DATA_EOF = 99;
-
- static internal string GetHostName()
- {
- if (s_hostName == null) {
- s_hostName = Dns.GetHostName();
-
- if (s_hostName == null) {
- throw new ArgumentNullException("hostName");
- }
- }
-
- return s_hostName;
- }
-
- static internal string GetMachineName()
- {
- if (s_MachineName == null) {
- string machineName = GetHostName();
- if (machineName != null) {
- IPHostEntry host = Dns.GetHostEntry(machineName);
- if (host != null)
- s_MachineName = host.HostName;
- }
-
- if (s_MachineName == null) {
- throw new ArgumentNullException("machine");
- }
- }
-
- return s_MachineName;
- }
-
-
-
- static internal bool IsLocalIpAddress(IPAddress remoteAddress)
- {
- if (s_MachineIpAddress == null) {
- string hostName = GetMachineName();
-
-
-
- IPHostEntry ipEntries = Dns.GetHostEntry(hostName);
-
- if (ipEntries != null && ipEntries.AddressList.Length == 1) {
- s_MachineIpAddress = GetMachineAddress(ipEntries, AddressFamily.InterNetwork);
- }
- else {
- return IsLocalIpAddress(ipEntries, AddressFamily.InterNetwork, remoteAddress);
- }
- }
- return s_MachineIpAddress.Equals(remoteAddress);
- }
-
-
- static internal bool IsLocalIpAddress(IPHostEntry host, AddressFamily addressFamily, IPAddress remoteAddress)
- {
- if (host != null) {
- IPAddress[] addressList = host.AddressList;
- for (int i = 0; i < addressList.Length; i++) {
- if (addressList[i].AddressFamily == addressFamily) {
- if (addressList[i].Equals(remoteAddress))
- return true;
- }
- }
- }
- return false;
- }
-
-
-
- static internal string DecodeMachineName(string machineName)
- {
- if (machineName.Equals("$hostName"))
- return GetHostName();
-
- return machineName;
- }
-
-
- static internal string GetMachineIp()
- {
- if (s_MachineIp == null) {
- string hostName = GetMachineName();
-
-
-
- IPHostEntry ipEntries = Dns.GetHostEntry(hostName);
- IPAddress addr = GetMachineAddress(ipEntries, AddressFamily.InterNetwork);
- if (addr != null) {
- s_MachineIp = addr.ToString();
- }
-
- if (s_MachineIp == null) {
- throw new ArgumentNullException("ip");
- }
- }
-
- return s_MachineIp;
- }
-
-
-
- static internal IPAddress GetMachineAddress(IPHostEntry host, AddressFamily addressFamily)
- {
-
-
- IPAddress result = null;
- if (host != null) {
-
- IPAddress[] addressList = host.AddressList;
- for (int i = 0; i < addressList.Length; i++) {
- if (addressList[i].AddressFamily == addressFamily) {
- result = addressList[i];
- break;
- }
- }
- }
-
-
- return result;
- }
-
-
-
-
-
- static internal Header[] GetMessagePropertiesAsSoapHeader(IMessage reqMsg)
- {
- IDictionary d = reqMsg.Properties;
- if (d == null)
- return null;
-
- int count = d.Count;
- if (count == 0)
- return null;
-
- IDictionaryEnumerator e = (IDictionaryEnumerator)d.GetEnumerator();
-
-
- bool[] map = new bool[count];
- int len = 0;
- int i = 0;
- IMethodMessage msg = (IMethodMessage)reqMsg;
- while (e.MoveNext()) {
- string key = (string)e.Key;
- if ((key.Length >= 2) && (String.CompareOrdinal(key, 0, "__", 0, 2) == 0) && (key.Equals("__Args") || key.Equals("__OutArgs") || key.Equals("__Return") || key.Equals("__Uri") || key.Equals("__MethodName") || (key.Equals("__MethodSignature") && (!RemotingServices.IsMethodOverloaded(msg)) && (!msg.HasVarArgs)) || key.Equals("__TypeName") || key.Equals("__Fault") || (key.Equals("__CallContext") && ((e.Value != null) ? (((LogicalCallContext)e.Value).HasInfo == false) : true)))) {
- i++;
- continue;
- }
- map[i] = true;
- i++;
- len++;
- }
- if (len == 0)
- return null;
-
-
- Header[] ret = new Header[len];
- e.Reset();
- int k = 0;
- i = 0;
- while (e.MoveNext()) {
- object key = e.Key;
- if (!map[k]) {
- k++;
- continue;
- }
-
- Header h = e.Value as Header;
-
-
- if (h == null) {
- h = new Header((string)key, e.Value, false, "http://schemas.microsoft.com/clr/soap/messageProperties");
- }
-
- if (i == ret.Length) {
- InternalRemotingServices.RemotingTrace("HTTPChannel::GetHeaders creating a new array of length " + (i + 1) + "\n");
- Header[] newret = new Header[i + 1];
- Array.Copy(ret, newret, i);
- ret = newret;
- }
- ret[i] = h;
- i++;
- k++;
- }
-
- return ret;
- }
-
-
- static internal Header[] GetSoapHeaders(IMessage reqMsg)
- {
-
- Header[] msgProperties = GetMessagePropertiesAsSoapHeader(reqMsg);
-
- return msgProperties;
- }
-
-
-
- static internal SoapFormatter CreateSoapFormatter(bool serialize, bool includeVersions)
- {
- SoapFormatter remotingFormatter = new SoapFormatter();
-
- if (serialize) {
- RemotingSurrogateSelector rss = new RemotingSurrogateSelector();
- remotingFormatter.SurrogateSelector = rss;
- rss.UseSoapFormat();
- }
- else
- remotingFormatter.SurrogateSelector = null;
-
- remotingFormatter.Context = new StreamingContext(StreamingContextStates.Other);
-
- remotingFormatter.AssemblyFormat = includeVersions ? FormatterAssemblyStyle.Full : FormatterAssemblyStyle.Simple;
-
- return remotingFormatter;
- }
-
-
- static internal BinaryFormatter CreateBinaryFormatter(bool serialize, bool includeVersionsOrStrictBinding)
- {
- BinaryFormatter remotingFormatter = new BinaryFormatter();
-
- if (serialize) {
- RemotingSurrogateSelector rss = new RemotingSurrogateSelector();
- remotingFormatter.SurrogateSelector = rss;
- }
- else {
- remotingFormatter.SurrogateSelector = null;
- }
-
- remotingFormatter.Context = new StreamingContext(StreamingContextStates.Other);
-
- remotingFormatter.AssemblyFormat = includeVersionsOrStrictBinding ? FormatterAssemblyStyle.Full : FormatterAssemblyStyle.Simple;
-
- return remotingFormatter;
- }
-
-
-
-
- static internal void SerializeSoapMessage(IMessage msg, Stream outputStream, bool includeVersions)
- {
-
- SoapFormatter fmt = CreateSoapFormatter(true, includeVersions);
-
-
- IMethodMessage methodMsg = msg as IMethodMessage;
- if (methodMsg != null) {
- MethodBase mb = methodMsg.MethodBase;
- if (mb != null) {
- Type type = methodMsg.MethodBase.DeclaringType;
- SoapTypeAttribute cache = (SoapTypeAttribute)InternalRemotingServices.GetCachedSoapAttribute(type);
- if ((cache.SoapOptions & SoapOption.AlwaysIncludeTypes) == SoapOption.AlwaysIncludeTypes)
- fmt.TypeFormat |= FormatterTypeStyle.TypesAlways;
- if ((cache.SoapOptions & SoapOption.XsdString) == SoapOption.XsdString)
- fmt.TypeFormat |= FormatterTypeStyle.XsdString;
- }
- }
-
-
- Header[] h = GetSoapHeaders(msg);
-
-
-
- ((RemotingSurrogateSelector)fmt.SurrogateSelector).SetRootObject(msg);
- fmt.Serialize(outputStream, msg, h);
- }
-
- static internal Stream SerializeSoapMessage(IMessage msg, bool includeVersions)
- {
- MemoryStream memStream = new MemoryStream();
- SerializeSoapMessage(msg, memStream, includeVersions);
- memStream.Position = 0;
- return memStream;
- }
-
-
-
- static internal void SerializeBinaryMessage(IMessage msg, Stream outputStream, bool includeVersions)
- {
-
- BinaryFormatter fmt = CreateBinaryFormatter(true, includeVersions);
-
-
-
-
- fmt.Serialize(outputStream, msg, null);
- }
-
- static internal Stream SerializeBinaryMessage(IMessage msg, bool includeVersions)
- {
- MemoryStream memStream = new MemoryStream();
- SerializeBinaryMessage(msg, memStream, includeVersions);
- memStream.Position = 0;
- return memStream;
- }
-
-
-
-
-
- private class UriHeaderHandler
- {
- string _uri = null;
-
- internal UriHeaderHandler(string uri)
- {
- _uri = uri;
- }
-
- public object HeaderHandler(Header[] Headers)
- {
- return _uri;
- }
-
- }
-
-
- static internal IMessage DeserializeSoapRequestMessage(Stream inputStream, Header[] h, bool bStrictBinding, TypeFilterLevel securityLevel)
- {
- SoapFormatter fmt = CreateSoapFormatter(false, bStrictBinding);
- fmt.FilterLevel = securityLevel;
-
- MethodCall mc = new MethodCall(h);
- fmt.Deserialize(inputStream, new HeaderHandler(mc.HeaderHandler));
-
- IMessage resMessage = (IMessage)mc;
-
- return resMessage;
- }
-
-
- static internal IMessage DeserializeSoapResponseMessage(Stream inputStream, IMessage requestMsg, Header[] h, bool bStrictBinding)
- {
- SoapFormatter fmt = CreateSoapFormatter(false, bStrictBinding);
-
- IMethodCallMessage mcm = (IMethodCallMessage)requestMsg;
- MethodResponse mr = new MethodResponse(h, mcm);
- fmt.Deserialize(inputStream, new HeaderHandler(mr.HeaderHandler));
-
- IMessage resMessage = (IMessage)mr;
-
- return resMessage;
- }
-
-
- static internal IMessage DeserializeBinaryRequestMessage(string objectUri, Stream inputStream, bool bStrictBinding, TypeFilterLevel securityLevel)
- {
- BinaryFormatter fmt = CreateBinaryFormatter(false, bStrictBinding);
- fmt.FilterLevel = securityLevel;
-
- UriHeaderHandler uriHH = new UriHeaderHandler(objectUri);
-
- IMessage reqMsg = (IMessage)fmt.UnsafeDeserialize(inputStream, new HeaderHandler(uriHH.HeaderHandler));
-
- return reqMsg;
- }
-
-
- static internal IMessage DeserializeBinaryResponseMessage(Stream inputStream, IMethodCallMessage reqMsg, bool bStrictBinding)
- {
- BinaryFormatter fmt = CreateBinaryFormatter(false, bStrictBinding);
-
- IMessage replyMsg = (IMessage)fmt.UnsafeDeserializeMethodResponse(inputStream, null, reqMsg);
- return replyMsg;
- }
-
- static internal Stream SerializeMessage(string mimeType, IMessage msg, bool includeVersions)
- {
- Stream returnStream = new MemoryStream();
- SerializeMessage(mimeType, msg, returnStream, includeVersions);
- returnStream.Position = 0;
- return returnStream;
- }
-
-
- static internal void SerializeMessage(string mimeType, IMessage msg, Stream outputStream, bool includeVersions)
- {
- InternalRemotingServices.RemotingTrace("SerializeMessage");
- InternalRemotingServices.RemotingTrace("MimeType: " + mimeType);
- CoreChannel.DebugMessage(msg);
-
- if (string.Compare(mimeType, SOAPMimeType, StringComparison.Ordinal) == 0) {
- SerializeSoapMessage(msg, outputStream, includeVersions);
- }
- else if (string.Compare(mimeType, BinaryMimeType, StringComparison.Ordinal) == 0) {
- SerializeBinaryMessage(msg, outputStream, includeVersions);
- }
-
- InternalRemotingServices.RemotingTrace("SerializeMessage: OUT");
- }
-
-
-
-
- static internal IMessage DeserializeMessage(string mimeType, Stream xstm, bool methodRequest, IMessage msg)
- {
- return DeserializeMessage(mimeType, xstm, methodRequest, msg, null);
- }
-
- static internal IMessage DeserializeMessage(string mimeType, Stream xstm, bool methodRequest, IMessage msg, Header[] h)
- {
- InternalRemotingServices.RemotingTrace("DeserializeMessage");
- InternalRemotingServices.RemotingTrace("MimeType: " + mimeType);
-
- CoreChannel.DebugOutXMLStream(xstm, "Deserializing");
-
- Stream fmtStm = null;
-
- bool bin64encode = false;
- bool doHeaderBodyAsOne = true;
-
- if (string.Compare(mimeType, BinaryMimeType, StringComparison.Ordinal) == 0) {
- doHeaderBodyAsOne = true;
- }
-
- if (string.Compare(mimeType, SOAPMimeType, StringComparison.Ordinal) == 0) {
- doHeaderBodyAsOne = false;
- }
-
- if (bin64encode == false) {
- fmtStm = xstm;
- }
- else {
- InternalRemotingServices.RemotingTrace("***************** Before base64 decode *****");
-
- long Position = xstm.Position;
- MemoryStream inStm = (MemoryStream)xstm;
- byte[] byteArray = inStm.ToArray();
- xstm.Position = Position;
-
- string base64String = Encoding.ASCII.GetString(byteArray, 0, byteArray.Length);
-
- byte[] byteArrayContent = Convert.FromBase64String(base64String);
-
- MemoryStream memStm = new MemoryStream(byteArrayContent);
-
- fmtStm = memStm;
- InternalRemotingServices.RemotingTrace("***************** after base64 decode *****");
- }
-
- object ret;
- IRemotingFormatter fmt = MimeTypeToFormatter(mimeType, false);
-
- if (doHeaderBodyAsOne == true) {
- ret = ((BinaryFormatter)fmt).UnsafeDeserializeMethodResponse(fmtStm, null, (IMethodCallMessage)msg);
- }
- else {
- InternalRemotingServices.RemotingTrace("Content");
- InternalRemotingServices.RemotingTrace("***************** Before Deserialize Headers *****");
-
- InternalRemotingServices.RemotingTrace("***************** After Deserialize Headers *****");
-
- InternalRemotingServices.RemotingTrace("***************** Before Deserialize Message *****");
-
- if (methodRequest == true) {
- MethodCall mc = new MethodCall(h);
- InternalRemotingServices.RemotingTrace("***************** Before Deserialize Message - as MethodCall *****");
- fmt.Deserialize(fmtStm, new HeaderHandler(mc.HeaderHandler));
- ret = mc;
- }
- else {
- IMethodCallMessage mcm = (IMethodCallMessage)msg;
- MethodResponse mr = new MethodResponse(h, mcm);
- InternalRemotingServices.RemotingTrace("***************** Before Deserialize Message - as MethodResponse *****");
- fmt.Deserialize(fmtStm, new HeaderHandler(mr.HeaderHandler));
- ret = mr;
- }
-
- InternalRemotingServices.RemotingTrace("***************** After Deserialize Message *****");
- }
-
-
- IMessage resMessage = (IMessage)ret;
-
- InternalRemotingServices.RemotingTrace("CoreChannel::DeserializeMessage OUT");
- CoreChannel.DebugMessage(resMessage);
-
- return resMessage;
- }
-
-
-
- static internal IRemotingFormatter MimeTypeToFormatter(string mimeType, bool serialize)
- {
- InternalRemotingServices.RemotingTrace("MimeTypeToFormatter: mimeType: " + mimeType);
-
- if (string.Compare(mimeType, SOAPMimeType, StringComparison.Ordinal) == 0) {
- return CreateSoapFormatter(serialize, true);
- }
- else if (string.Compare(mimeType, BinaryMimeType, StringComparison.Ordinal) == 0) {
- return CreateBinaryFormatter(serialize, true);
- }
-
- return null;
- }
-
-
-
-
-
-
-
- static internal string RemoveApplicationNameFromUri(string uri)
- {
- if (uri == null)
- return null;
-
- string appName = RemotingConfiguration.ApplicationName;
- if ((appName == null) || (appName.Length == 0))
- return uri;
-
-
- if (uri.Length < (appName.Length + 2))
- return uri;
-
-
- if (String.Compare(appName, 0, uri, 0, appName.Length, StringComparison.OrdinalIgnoreCase) == 0) {
-
-
- if (uri[appName.Length] == '/') {
- uri = uri.Substring(appName.Length + 1);
- }
- }
-
- return uri;
- }
-
-
- static internal void AppendProviderToClientProviderChain(IClientChannelSinkProvider providerChain, IClientChannelSinkProvider provider)
- {
- if (providerChain == null)
- throw new ArgumentNullException("providerChain");
-
-
- while (providerChain.Next != null) {
- providerChain = providerChain.Next;
- }
-
- providerChain.Next = provider;
- }
-
- static internal void CollectChannelDataFromServerSinkProviders(ChannelDataStore channelData, IServerChannelSinkProvider provider)
- {
-
- while (provider != null) {
- provider.GetChannelData(channelData);
-
- provider = provider.Next;
- }
- }
-
-
-
- static internal void VerifyNoProviderData(string providerTypeName, ICollection providerData)
- {