Beispiel #1
0
 /// <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);
     }
 }
Beispiel #2
0
        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);
            }
        }
Beispiel #3
0
        /// <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);
        }
Beispiel #4
0
        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));
            }
        }
Beispiel #5
0
        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");
            }
        }
Beispiel #6
0
 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;
 }
Beispiel #7
0
 public void AddXmlAttribute(Type fieldType, string fieldName, string xmlAttribute, string xmlNamespace)
 {
     this._attributes[SoapServices.CreateKey(xmlAttribute, xmlNamespace)] = new SoapServices.XmlToFieldTypeMap.FieldEntry(fieldType, fieldName);
 }
Beispiel #8
0
 public void AddXmlElement(Type fieldType, string fieldName, string xmlElement, string xmlNamespace)
 {
     this._elements[SoapServices.CreateKey(xmlElement, xmlNamespace)] = new SoapServices.XmlToFieldTypeMap.FieldEntry(fieldType, fieldName);
 }
Beispiel #9
0
 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);
 }
Beispiel #10
0
 public static Type GetInteropTypeFromXmlType(string xmlType, string xmlTypeNamespace)
 {
     return((Type)SoapServices._interopXmlTypeToType[SoapServices.CreateKey(xmlType, xmlTypeNamespace)]);
 }
Beispiel #11
0
 public static Type GetInteropTypeFromXmlElement(string xmlElement, string xmlNamespace)
 {
     return((Type)SoapServices._interopXmlElementToType[SoapServices.CreateKey(xmlElement, xmlNamespace)]);
 }
Beispiel #12
0
 /// <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);
 }
Beispiel #13
0
 /// <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)));
 }
Beispiel #14
0
 /// <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));
 }
Beispiel #15
0
 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;
     }
 }
Beispiel #16
0
 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);
 }