/// <summary>Decodes the XML namespace and assembly names from the provided common language runtime namespace.</summary> /// <returns>true if the namespace and assembly names were successfully decoded; otherwise, false.</returns> /// <param name="inNamespace">The common language runtime namespace. </param> /// <param name="typeNamespace">When this method returns, contains a <see cref="T:System.String" /> that holds the decoded namespace name. This parameter is passed uninitialized. </param> /// <param name="assemblyName">When this method returns, contains a <see cref="T:System.String" /> that holds the decoded assembly name. This parameter is passed uninitialized. </param> /// <exception cref="T:System.ArgumentNullException">The <paramref name="inNamespace" /> parameter is null or empty. </exception> /// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception> /// <PermissionSet> /// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" /> /// </PermissionSet> public static bool DecodeXmlNamespaceForClrTypeNamespace(string inNamespace, out string typeNamespace, out string assemblyName) { if (inNamespace == null) { throw new ArgumentNullException("inNamespace"); } inNamespace = SoapServices.DecodeNs(inNamespace); typeNamespace = null; assemblyName = null; if (inNamespace.StartsWith(SoapServices.XmlNsForClrTypeWithNsAndAssembly)) { int length = SoapServices.XmlNsForClrTypeWithNsAndAssembly.Length; if (length >= inNamespace.Length) { return(false); } int num = inNamespace.IndexOf('/', length + 1); if (num == -1) { return(false); } typeNamespace = inNamespace.Substring(length, num - length); assemblyName = inNamespace.Substring(num + 1); return(true); } else { if (inNamespace.StartsWith(SoapServices.XmlNsForClrTypeWithNs)) { int length2 = SoapServices.XmlNsForClrTypeWithNs.Length; typeNamespace = inNamespace.Substring(length2); return(true); } if (inNamespace.StartsWith(SoapServices.XmlNsForClrTypeWithAssembly)) { int length3 = SoapServices.XmlNsForClrTypeWithAssembly.Length; assemblyName = inNamespace.Substring(length3); return(true); } return(false); } }
private void ReadInteropXml(SmallXmlParser.IAttrList attrs, bool isElement) { Type type = Type.GetType(this.GetNotNull(attrs, "clr")); string[] array = this.GetNotNull(attrs, "xml").Split(new char[] { ',' }); string text = array[0].Trim(); string text2 = (array.Length <= 0) ? null : array[1].Trim(); if (isElement) { SoapServices.RegisterInteropXmlElement(text, text2, type); } else { SoapServices.RegisterInteropXmlType(text, text2, type); } }
/// <summary>Determines the type and method name of the method associated with the specified SOAPAction value.</summary> /// <returns>true if the type and method name were successfully recovered; otherwise, false.</returns> /// <param name="soapAction">The SOAPAction of the method for which the type and method names were requested. </param> /// <param name="typeName">When this method returns, contains a <see cref="T:System.String" /> that holds the type name of the method in question. This parameter is passed uninitialized. </param> /// <param name="methodName">When this method returns, contains a <see cref="T:System.String" /> that holds the method name of the method in question. This parameter is passed uninitialized. </param> /// <exception cref="T:System.Runtime.Remoting.RemotingException">The SOAPAction value does not start and end with quotes. </exception> /// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception> /// <PermissionSet> /// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" /> /// </PermissionSet> public static bool GetTypeAndMethodNameFromSoapAction(string soapAction, out string typeName, out string methodName) { object syncRoot = SoapServices._soapActions.SyncRoot; lock (syncRoot) { MethodBase methodBase = (MethodBase)SoapServices._soapActionsMethods[soapAction]; if (methodBase != null) { typeName = methodBase.DeclaringType.AssemblyQualifiedName; methodName = methodBase.Name; return(true); } } typeName = null; methodName = null; int num = soapAction.LastIndexOf('#'); if (num == -1) { return(false); } methodName = soapAction.Substring(num + 1); string str; string text; if (!SoapServices.DecodeXmlNamespaceForClrTypeNamespace(soapAction.Substring(0, num), out str, out text)) { return(false); } if (text == null) { typeName = str + ", " + typeof(object).Assembly.GetName().Name; } else { typeName = str + ", " + text; } return(true); }
private void ReadPreload(SmallXmlParser.IAttrList attrs) { string value = attrs.GetValue("type"); string value2 = attrs.GetValue("assembly"); if (value != null && value2 != null) { throw new RemotingException("Type and assembly attributes cannot be specified together"); } if (value != null) { SoapServices.PreLoad(Type.GetType(value)); } else { if (value2 == null) { throw new RemotingException("Either type or assembly attributes must be specified"); } SoapServices.PreLoad(Assembly.Load(value2)); } }
void ReadPreload(SmallXmlParser.IAttrList attrs) { string type = attrs.GetValue("type"); string assm = attrs.GetValue("assembly"); if (type != null && assm != null) { throw new RemotingException("Type and assembly attributes cannot be specified together"); } if (type != null) { SoapServices.PreLoad(Type.GetType(type)); } else if (assm != null) { SoapServices.PreLoad(Assembly.Load(assm)); } else { throw new RemotingException("Either type or assembly attributes must be specified"); } }
public void GetFieldTypeAndNameFromXmlAttribute(string xmlAttribute, string xmlNamespace, out Type type, out string name) { SoapServices.XmlToFieldTypeMap.FieldEntry fieldEntry = (SoapServices.XmlToFieldTypeMap.FieldEntry) this._attributes[SoapServices.CreateKey(xmlAttribute, xmlNamespace)]; if (fieldEntry != null) { type = fieldEntry.Type; name = fieldEntry.Name; return; } type = null; name = null; }
public void AddXmlAttribute(Type fieldType, string fieldName, string xmlAttribute, string xmlNamespace) { this._attributes[SoapServices.CreateKey(xmlAttribute, xmlNamespace)] = new SoapServices.XmlToFieldTypeMap.FieldEntry(fieldType, fieldName); }
public void AddXmlElement(Type fieldType, string fieldName, string xmlElement, string xmlNamespace) { this._elements[SoapServices.CreateKey(xmlElement, xmlNamespace)] = new SoapServices.XmlToFieldTypeMap.FieldEntry(fieldType, fieldName); }
public static void RegisterInteropXmlType(string xmlType, string xmlTypeNamespace, Type type) { SoapServices._interopXmlTypeToType[SoapServices.CreateKey(xmlType, xmlTypeNamespace)] = type; SoapServices._interopTypeToXmlType[type] = new SoapServices.XmlEntry(xmlType, xmlTypeNamespace); }
public static Type GetInteropTypeFromXmlType(string xmlType, string xmlTypeNamespace) { return((Type)SoapServices._interopXmlTypeToType[SoapServices.CreateKey(xmlType, xmlTypeNamespace)]); }
public static Type GetInteropTypeFromXmlElement(string xmlElement, string xmlNamespace) { return((Type)SoapServices._interopXmlElementToType[SoapServices.CreateKey(xmlElement, xmlNamespace)]); }
/// <summary>Associates the specified <see cref="T:System.Reflection.MethodBase" /> with the SOAPAction cached with it.</summary> /// <param name="mb">The <see cref="T:System.Reflection.MethodBase" /> of the method to associate with the SOAPAction cached with it. </param> /// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception> /// <PermissionSet> /// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" /> /// </PermissionSet> public static void RegisterSoapActionForMethodBase(MethodBase mb) { SoapServices.InternalGetSoapAction(mb); }
/// <summary>Retrieves the XML namespace used during the generation of responses to the remote call to the method specified in the given <see cref="T:System.Reflection.MethodBase" />.</summary> /// <returns>The XML namespace used during the generation of responses to a remote method call.</returns> /// <param name="mb">The <see cref="T:System.Reflection.MethodBase" /> of the method for which the XML namespace was requested. </param> /// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception> /// <PermissionSet> /// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" /> /// </PermissionSet> public static string GetXmlNamespaceForMethodResponse(MethodBase mb) { return(SoapServices.CodeXmlNamespaceForClrTypeNamespace(mb.DeclaringType.FullName, SoapServices.GetAssemblyName(mb))); }
/// <summary>Returns the SOAPAction value associated with the method specified in the given <see cref="T:System.Reflection.MethodBase" />.</summary> /// <returns>The SOAPAction value associated with the method specified in the given <see cref="T:System.Reflection.MethodBase" />.</returns> /// <param name="mb">The <see cref="T:System.Reflection.MethodBase" /> that contains the method for which a SOAPAction is requested. </param> /// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception> /// <PermissionSet> /// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" /> /// </PermissionSet> public static string GetSoapActionFromMethodBase(MethodBase mb) { return(SoapServices.InternalGetSoapAction(mb)); }
public void GetFieldTypeAndNameFromXmlElement(string xmlElement, string xmlNamespace, out Type type, out string name) { SoapServices.XmlToFieldTypeMap.FieldEntry fieldEntry = (SoapServices.XmlToFieldTypeMap.FieldEntry) this._elements[(object)SoapServices.CreateKey(xmlElement, xmlNamespace)]; if (fieldEntry != null) { type = fieldEntry.Type; name = fieldEntry.Name; } else { type = (Type)null; name = (string)null; } }
public static void RegisterInteropXmlElement(string xmlElement, string xmlNamespace, Type type) { SoapServices._interopXmlElementToType[(object)SoapServices.CreateKey(xmlElement, xmlNamespace)] = (object)type; SoapServices._interopTypeToXmlElement[(object)type] = (object)new SoapServices.XmlEntry(xmlElement, xmlNamespace); }