System.Runtime.Remoting.XmlNamespaceEncoder.GetTypeNameForSoapActionNamespace C# (CSharp) Méthode

GetTypeNameForSoapActionNamespace() static private méthode

static private GetTypeNameForSoapActionNamespace ( String uri, bool &assemblyIncluded ) : String
uri String
assemblyIncluded bool
Résultat String
        internal static String GetTypeNameForSoapActionNamespace(String uri, out bool assemblyIncluded)
        {
            assemblyIncluded = false;
            String urtNSprefix = SoapServices.fullNS;
            String systemNSprefix = SoapServices.namespaceNS;
            
            if (uri.StartsWith(urtNSprefix, StringComparison.Ordinal))
            {
                uri = uri.Substring(urtNSprefix.Length); // now contains type/assembly
                char[] sep = new char[]{'/'};
                String[] parts = uri.Split(sep); 
                if (parts.Length != 2)
                    return null;
                else
                {
                    assemblyIncluded = true;
                    return parts[0] + ", " + parts[1];
                }
            }
            if (uri.StartsWith(systemNSprefix, StringComparison.Ordinal))
            {
                String assemName = typeof(String).Module.Assembly.nGetSimpleName();
                assemblyIncluded = true;
                return uri.Substring(systemNSprefix.Length) + ", " + assemName; // now contains type
            }

            return null;
        } // GetTypeForXmlNamespace
    } // XmlNamespaceEncoder

Usage Example

        public static bool IsSoapActionValidForMethodBase(string soapAction, MethodBase mb)
        {
            bool          flag;
            RuntimeModule runtimeModule;

            if (mb == null)
            {
                throw new ArgumentNullException("mb");
            }
            if ((soapAction[0] == '"') && (soapAction[soapAction.Length - 1] == '"'))
            {
                soapAction = soapAction.Substring(1, soapAction.Length - 2);
            }
            SoapMethodAttribute cachedSoapAttribute = (SoapMethodAttribute)InternalRemotingServices.GetCachedSoapAttribute(mb);

            if (string.CompareOrdinal(cachedSoapAttribute.SoapAction, soapAction) == 0)
            {
                return(true);
            }
            string strA = (string)_methodBaseToSoapAction[mb];

            if ((strA != null) && (string.CompareOrdinal(strA, soapAction) == 0))
            {
                return(true);
            }
            string[] strArray = soapAction.Split(new char[] { '#' });
            if (strArray.Length != 2)
            {
                return(false);
            }
            string typeNameForSoapActionNamespace = XmlNamespaceEncoder.GetTypeNameForSoapActionNamespace(strArray[0], out flag);

            if (typeNameForSoapActionNamespace == null)
            {
                return(false);
            }
            string                 str3  = strArray[1];
            RuntimeMethodInfo      info  = mb as RuntimeMethodInfo;
            RuntimeConstructorInfo info2 = mb as RuntimeConstructorInfo;

            if (info != null)
            {
                runtimeModule = info.GetRuntimeModule();
            }
            else
            {
                if (info2 == null)
                {
                    throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeReflectionObject"));
                }
                runtimeModule = info2.GetRuntimeModule();
            }
            string fullName = mb.DeclaringType.FullName;

            if (flag)
            {
                fullName = fullName + ", " + runtimeModule.GetRuntimeAssembly().GetSimpleName();
            }
            return(fullName.Equals(typeNameForSoapActionNamespace) && mb.Name.Equals(str3));
        }
All Usage Examples Of System.Runtime.Remoting.XmlNamespaceEncoder::GetTypeNameForSoapActionNamespace