本文整理汇总了C#中System.Runtime.Remoting.Messaging.Header类的典型用法代码示例。如果您正苦于以下问题:C# Header类的具体用法?C# Header怎么用?C# Header使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Header类属于System.Runtime.Remoting.Messaging命名空间,在下文中一共展示了Header类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MethodCall
public MethodCall(Header[] h1)
{
this.Init();
this.fSoap = true;
this.FillHeaders(h1);
this.ResolveMethod();
}
示例2: GetChannelHeaders
private Header[] GetChannelHeaders(ITransportHeaders requestHeaders, out string soapActionToVerify)
{
string str3;
string str4;
soapActionToVerify = null;
string uRI = (string) requestHeaders["__RequestUri"];
string uri = (string) requestHeaders["SOAPAction"];
if (uri == null)
{
throw new RemotingException(CoreChannel.GetResourceString("Remoting_SoapActionMissing"));
}
uri = HttpEncodingHelper.DecodeUri(uri);
soapActionToVerify = uri;
if (!SoapServices.GetTypeAndMethodNameFromSoapAction(uri, out str3, out str4))
{
Type serverTypeForUri = RemotingServices.GetServerTypeForUri(uRI);
if (serverTypeForUri == null)
{
throw new RemotingException(string.Format(CultureInfo.CurrentCulture, CoreChannel.GetResourceString("Remoting_TypeNotFoundFromUri"), new object[] { uRI }));
}
str3 = "clr:" + serverTypeForUri.FullName + ", " + serverTypeForUri.Assembly.GetName().Name;
}
else
{
str3 = "clr:" + str3;
}
int num = 2;
Header[] headerArray = new Header[num];
headerArray[0] = new Header("__Uri", uRI);
headerArray[1] = new Header("__TypeName", str3);
return headerArray;
}
示例3: DeserializeMessage
private IMessage DeserializeMessage(IMethodCallMessage mcm, ITransportHeaders headers, Stream stream)
{
IMessage message;
string str2;
string str3;
Header[] h = new Header[] { new Header("__TypeName", mcm.TypeName), new Header("__MethodName", mcm.MethodName), new Header("__MethodSignature", mcm.MethodSignature) };
string contentType = headers["Content-Type"] as string;
HttpChannelHelper.ParseContentType(contentType, out str2, out str3);
if (string.Compare(str2, "text/xml", StringComparison.Ordinal) == 0)
{
message = CoreChannel.DeserializeSoapResponseMessage(stream, mcm, h, this._strictBinding);
}
else
{
int count = 0x400;
byte[] buffer = new byte[count];
StringBuilder builder = new StringBuilder();
for (int i = stream.Read(buffer, 0, count); i > 0; i = stream.Read(buffer, 0, count))
{
builder.Append(Encoding.ASCII.GetString(buffer, 0, i));
}
message = new ReturnMessage(new RemotingException(builder.ToString()), mcm);
}
stream.Close();
return message;
}
示例4: Serialize
public void Serialize(Stream serializationStream, object graph, Header[] headers) {
if(serializationStream == null)
throw new ArgumentNullException("serializationStream");
if(!serializationStream.CanWrite)
throw new SerializationException("Can't write in the serialization stream");
if(graph == null)
throw new ArgumentNullException("graph");
SoapWriter soapWriter = new SoapWriter(serializationStream, _selector, _context, _topObject);
soapWriter.Serialize (graph, headers, _typeFormat, _assemblyFormat);
}
示例5: StaticConsumeContext
ConsumeContext IMessageDeserializer.Deserialize(ReceiveContext receiveContext)
{
object obj;
var headers = new Header[0];
using (Stream body = receiveContext.GetBody())
{
obj = _formatter.Deserialize(body, x => headers = x);
}
return new StaticConsumeContext(_sendEndpointProvider, _publishEndpoint, receiveContext, obj, headers);
}
示例6: MethodCall
public MethodCall (Header [] h1)
{
Init();
if (h1 == null || h1.Length == 0) return;
foreach (Header header in h1)
InitMethodProperty (header.Name, header.Value);
ResolveMethod ();
}
示例7: Serialize
public void Serialize(Stream serializationStream, object graph, Header[] headers)
{
if (serializationStream == null)
{
throw new ArgumentNullException("serializationStream");
}
InternalFE formatterEnums = new InternalFE {
FEtypeFormat = this.m_typeFormat,
FEtopObject = this.m_topObject,
FEserializerTypeEnum = InternalSerializerTypeE.Soap,
FEassemblyFormat = this.m_assemblyFormat
};
new ObjectWriter(serializationStream, this.m_surrogates, this.m_context, formatterEnums).Serialize(graph, headers, new SoapWriter(serializationStream));
}
示例8: MethodCall
// Constructors.
public MethodCall(Header[] h1)
{
isSoap = true; // This form is used for SOAP requests.
Init();
if(h1 != null)
{
foreach(Header h in h1)
{
ProcessHeader(h.Name, h.Value);
}
}
ResolveMethod();
AccessCheck();
}
示例9: MethodResponse
public MethodResponse (Header[] h1, IMethodCallMessage mcm)
{
if (mcm != null)
{
_methodName = mcm.MethodName;
_uri = mcm.Uri;
_typeName = mcm.TypeName;
_methodBase = mcm.MethodBase;
_methodSignature = (Type[]) mcm.MethodSignature;
_args = mcm.Args;
}
if (h1 != null)
{
foreach (Header header in h1)
InitMethodProperty (header.Name, header.Value);
}
}
示例10: Serialize
internal void Serialize(Stream serializationStream, object graph, Header[] headers, bool check)
{
if (serializationStream == null)
{
throw new ArgumentNullException(nameof(serializationStream));
}
var formatterEnums = new InternalFE()
{
_typeFormat = _typeFormat,
_serializerTypeEnum = InternalSerializerTypeE.Binary,
_assemblyFormat = _assemblyFormat,
};
var sow = new ObjectWriter(_surrogates, _context, formatterEnums, _binder);
BinaryFormatterWriter binaryWriter = new BinaryFormatterWriter(serializationStream, sow, _typeFormat);
sow.Serialize(graph, headers, binaryWriter, check);
_crossAppDomainArray = sow._crossAppDomainArray;
}
示例11: MethodResponse
// Constructors.
public MethodResponse(Header[] h1, IMethodCallMessage mcm)
{
isSoap = true; // This form is used for SOAP requests.
if(mcm == null)
{
throw new ArgumentNullException("mcm");
}
methodName = mcm.MethodName;
typeName = mcm.TypeName;
method = mcm.MethodBase;
hasVarArgs = mcm.HasVarArgs;
if(h1 != null)
{
foreach(Header header in h1)
{
ProcessHeader(header.Name, header.Value);
}
}
}
示例12: MethodResponse
public MethodResponse(Header[] h1, IMethodCallMessage mcm)
{
if (mcm == null)
{
throw new ArgumentNullException("mcm");
}
Message message = mcm as Message;
if (message != null)
{
this.MI = message.GetMethodBase();
}
else
{
this.MI = mcm.MethodBase;
}
if (this.MI == null)
{
throw new RemotingException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Message_MethodMissing"), new object[] { mcm.MethodName, mcm.TypeName }));
}
this._methodCache = InternalRemotingServices.GetReflectionCachedData(this.MI);
this.argCount = this._methodCache.Parameters.Length;
this.fSoap = true;
this.FillHeaders(h1);
}
示例13: InternalSetHeaders
internal void InternalSetHeaders(Header[] headers)
{
this._sendHeaders = headers;
this._recvHeaders = null;
}
示例14: GetPropertyKeyForHeader
internal static string GetPropertyKeyForHeader(Header header)
{
if (header == null)
{
return null;
}
if (header.HeaderNamespace != null)
{
return (header.Name + ", " + header.HeaderNamespace);
}
return header.Name;
}
示例15: ReadObjectGraph
public void ReadObjectGraph (BinaryElement elem, BinaryReader reader, bool readHeaders, out object result, out Header[] headers)
{
headers = null;
// Reads the objects. The first object in the stream is the
// root object.
bool next = ReadNextObject (elem, reader);
if (next) {
do {
if (readHeaders && (headers == null))
headers = (Header[])CurrentObject;
else
if (_rootObjectID == 0) _rootObjectID = _lastObjectID;
} while (ReadNextObject (reader));
}
result = _manager.GetObject (_rootObjectID);
}