public static bool IsSoapActionValidForMethodBase(String soapAction, MethodBase mb)
{
// remove quotation marks if present
if ((soapAction[0] == '"') && (soapAction[soapAction.Length - 1] == '"'))
soapAction = soapAction.Substring(1, soapAction.Length - 2);
// compare this to the soapAction on the method base
SoapMethodAttribute attr = (SoapMethodAttribute)
InternalRemotingServices.GetCachedSoapAttribute(mb);
if (String.CompareOrdinal(attr.SoapAction, soapAction) == 0)
return true;
// check to see if a soap action value is registered for this
String registeredSoapAction = (String)_methodBaseToSoapAction[mb];
if (registeredSoapAction != null)
{
if (String.CompareOrdinal(registeredSoapAction, soapAction) == 0)
return true;
}
// otherwise, parse SOAPAction and verify
String typeName, methodName;
String[] parts = soapAction.Split(new char[1]{'#'});
if (parts.Length == 2)
{
bool assemblyIncluded;
typeName = XmlNamespaceEncoder.GetTypeNameForSoapActionNamespace(
parts[0], out assemblyIncluded);
if (typeName == null)
return false;
methodName = parts[1];
// compare to values of method base (FUTURE: Use more direct method for this)
Type type = mb.DeclaringType;
String actualTypeName = type.FullName;
if (assemblyIncluded)
actualTypeName += ", " + type.Module.Assembly.nGetSimpleName();
// return true if type and method name are the same
return actualTypeName.Equals(typeName) && mb.Name.Equals(methodName);
}
else
return false;
} // IsSoapActionValidForMethodBase