private Type ProcessGetType(String value, String xmlKey, out String assemblyString)
{
InternalST.Soap( this, "ProcessGetType Entry xmlKey ",xmlKey," value ",value);
Type type = null;
String typeValue = null;
assemblyString = null;
// If there is an attribute which matches a preloaded type, then return the preloaded type
String httpstring = (String)keyToNamespaceTable["xmlns:"+xmlKey];
if (httpstring != null)
{
type= GetInteropType(value, httpstring);
if (type != null)
return type;
}
if ((String.Compare(value, "anyType", StringComparison.OrdinalIgnoreCase) == 0 || String.Compare(value, "ur-type", StringComparison.OrdinalIgnoreCase) == 0) && (xmlKey.Equals(xsdKey)))
type = SoapUtil.typeofObject;
else if ((xmlKey.Equals(xsdKey)) || (xmlKey.Equals(soapKey)))
{
if (String.Compare(value, "string", StringComparison.OrdinalIgnoreCase) == 0)
{
type = SoapUtil.typeofString;
}
else
{
InternalPrimitiveTypeE code = Converter.ToCode(value);
if (code == InternalPrimitiveTypeE.Invalid)
throw new SerializationException(String.Format(CultureInfo.CurrentCulture, SoapUtil.GetResourceString("Serialization_Parser_xsd"),value));
type = Converter.SoapToType(code);
}
}
else
{
if ( xmlKey == null)
throw new SerializationException(String.Format(CultureInfo.CurrentCulture, SoapUtil.GetResourceString("Serialization_Parser_xml"),value));
String nameSpace = (String)assemKeyToNameSpaceTable[xmlKey];
typeValue = null;
if (nameSpace == null || nameSpace.Length == 0)
typeValue = value;
else
typeValue = nameSpace+"."+value;
SoapAssemblyInfo assemblyInfo = (SoapAssemblyInfo)assemKeyToAssemblyTable[xmlKey];
if (assemblyInfo == null)
throw new SerializationException(String.Format(CultureInfo.CurrentCulture, SoapUtil.GetResourceString("Serialization_Parser_xmlAssembly"),xmlKey+" "+value));
assemblyString = assemblyInfo.assemblyString;
if (assemblyString != null)
{
// See if a SerializationBinder was defined to resolve this type
type = objectReader.Bind(assemblyString, typeValue);
if (type == null)
type= objectReader.FastBindToType(assemblyString, typeValue);
}
if (type == null)
{
Assembly assembly = null;
try
{
assembly = assemblyInfo.GetAssembly(objectReader);
}
catch {
}
if (assembly == null)
throw new SerializationException(String.Format(CultureInfo.CurrentCulture, SoapUtil.GetResourceString("Serialization_Parser_xmlAssembly"),xmlKey+":"+httpstring+" "+value));
else
type = FormatterServices.GetTypeFromAssembly(assembly, typeValue);
}
}
if (type == null)
throw new SerializationException(String.Format(CultureInfo.CurrentCulture, SoapUtil.GetResourceString("Serialization_Parser_xmlType"),xmlKey+" "+typeValue+" "+assemblyString));
InternalST.Soap( this, "ProcessGetType Exit ",type);
return type;
}