} // GetInteropFieldTypeFromXmlAttribute /// <include file='doc\Soap.uex' path='docs/doc[@for="SoapServices.GetXmlElementForInteropType"]/*' /> public static bool GetXmlElementForInteropType(Type type, out String xmlElement, out String xmlNamespace) { // check table first XmlEntry entry = (XmlEntry)_interopTypeToXmlElement[type]; if (entry != null) { xmlElement = entry.Name; xmlNamespace = entry.Namespace; return(true); } // check soap attribute SoapTypeAttribute attr = (SoapTypeAttribute) InternalRemotingServices.GetCachedSoapAttribute(type); if (attr.IsInteropXmlElement()) { xmlElement = attr.XmlElementName; xmlNamespace = attr.XmlNamespace; return(true); } else { xmlElement = null; xmlNamespace = null; return(false); } } // GetXmlElementForInteropType
} // RegisterInteropXmlType /// <include file='doc\Soap.uex' path='docs/doc[@for="SoapServices.PreLoad"]/*' /> public static void PreLoad(Type type) { // register soap action values MethodInfo[] methods = type.GetMethods(); foreach (MethodInfo mi in methods) { // This will only add an entry to the table if SoapAction was explicitly set // on the SoapMethodAttribute. RegisterSoapActionForMethodBase(mi); } // register interop xml elements and types if specified SoapTypeAttribute attr = (SoapTypeAttribute) InternalRemotingServices.GetCachedSoapAttribute(type); if (attr.IsInteropXmlElement()) { RegisterInteropXmlElement(attr.XmlElementName, attr.XmlNamespace, type); } if (attr.IsInteropXmlType()) { RegisterInteropXmlType(attr.XmlTypeName, attr.XmlTypeNamespace, type); } // construct field maps for mapping xml elements and attributes back to // the correct type int mapCount = 0; XmlToFieldTypeMap map = new XmlToFieldTypeMap(); foreach (FieldInfo field in type.GetFields()) { SoapFieldAttribute fieldAttr = (SoapFieldAttribute) InternalRemotingServices.GetCachedSoapAttribute(field); if (fieldAttr.IsInteropXmlElement()) { String xmlName = fieldAttr.XmlElementName; String xmlNamespace = fieldAttr.XmlNamespace; if (fieldAttr.UseAttribute) { map.AddXmlAttribute(field.FieldType, field.Name, xmlName, xmlNamespace); } else { map.AddXmlElement(field.FieldType, field.Name, xmlName, xmlNamespace); } mapCount++; } } // foreach field // add field map if there is more than one entry if (mapCount > 0) { _xmlToFieldTypeMap[type] = map; } } // PreLoad
public static void PreLoad(Type type) { if (type == null) { throw new ArgumentNullException("type"); } if (!(type is RuntimeType)) { throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType")); } MethodInfo[] methods = type.GetMethods(); foreach (MethodInfo mb in methods) { SoapServices.RegisterSoapActionForMethodBase(mb); } SoapTypeAttribute soapTypeAttribute = (SoapTypeAttribute)InternalRemotingServices.GetCachedSoapAttribute(type); if (soapTypeAttribute.IsInteropXmlElement()) { SoapServices.RegisterInteropXmlElement(soapTypeAttribute.XmlElementName, soapTypeAttribute.XmlNamespace, type); } if (soapTypeAttribute.IsInteropXmlType()) { SoapServices.RegisterInteropXmlType(soapTypeAttribute.XmlTypeName, soapTypeAttribute.XmlTypeNamespace, type); } int num = 0; SoapServices.XmlToFieldTypeMap xmlToFieldTypeMap = new SoapServices.XmlToFieldTypeMap(); foreach (FieldInfo fieldInfo in type.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)) { SoapFieldAttribute soapFieldAttribute = (SoapFieldAttribute)InternalRemotingServices.GetCachedSoapAttribute(fieldInfo); if (soapFieldAttribute.IsInteropXmlElement()) { string xmlElementName = soapFieldAttribute.XmlElementName; string xmlNamespace = soapFieldAttribute.XmlNamespace; if (soapFieldAttribute.UseAttribute) { xmlToFieldTypeMap.AddXmlAttribute(fieldInfo.FieldType, fieldInfo.Name, xmlElementName, xmlNamespace); } else { xmlToFieldTypeMap.AddXmlElement(fieldInfo.FieldType, fieldInfo.Name, xmlElementName, xmlNamespace); } num++; } } if (num > 0) { SoapServices._xmlToFieldTypeMap[type] = xmlToFieldTypeMap; } }
public static void PreLoad(Type type) { if (type == null) { throw new ArgumentNullException("type"); } if (!(type is RuntimeType)) { throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType")); } foreach (MethodInfo info in type.GetMethods()) { RegisterSoapActionForMethodBase(info); } SoapTypeAttribute cachedSoapAttribute = (SoapTypeAttribute)InternalRemotingServices.GetCachedSoapAttribute(type); if (cachedSoapAttribute.IsInteropXmlElement()) { RegisterInteropXmlElement(cachedSoapAttribute.XmlElementName, cachedSoapAttribute.XmlNamespace, type); } if (cachedSoapAttribute.IsInteropXmlType()) { RegisterInteropXmlType(cachedSoapAttribute.XmlTypeName, cachedSoapAttribute.XmlTypeNamespace, type); } int num = 0; XmlToFieldTypeMap map = new XmlToFieldTypeMap(); foreach (FieldInfo info2 in type.GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly)) { SoapFieldAttribute attribute2 = (SoapFieldAttribute)InternalRemotingServices.GetCachedSoapAttribute(info2); if (attribute2.IsInteropXmlElement()) { string xmlElementName = attribute2.XmlElementName; string xmlNamespace = attribute2.XmlNamespace; if (attribute2.UseAttribute) { map.AddXmlAttribute(info2.FieldType, info2.Name, xmlElementName, xmlNamespace); } else { map.AddXmlElement(info2.FieldType, info2.Name, xmlElementName, xmlNamespace); } num++; } } if (num > 0) { _xmlToFieldTypeMap[type] = map; } }
public static bool GetXmlElementForInteropType(Type type, out string xmlElement, out string xmlNamespace) { SoapServices.XmlEntry xmlEntry = (SoapServices.XmlEntry)SoapServices._interopTypeToXmlElement[type]; if (xmlEntry != null) { xmlElement = xmlEntry.Name; xmlNamespace = xmlEntry.Namespace; return(true); } SoapTypeAttribute soapTypeAttribute = (SoapTypeAttribute)InternalRemotingServices.GetCachedSoapAttribute(type); if (soapTypeAttribute.IsInteropXmlElement()) { xmlElement = soapTypeAttribute.XmlElementName; xmlNamespace = soapTypeAttribute.XmlNamespace; return(true); } xmlElement = null; xmlNamespace = null; return(false); }
[System.Security.SecurityCritical] // auto-generated public static void PreLoad(Type type) { if (type == null) { throw new ArgumentNullException("type"); } Contract.EndContractBlock(); if (!(type is RuntimeType)) { throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType")); } // register soap action values MethodInfo[] methods = type.GetMethods(); foreach (MethodInfo mi in methods) { // This will only add an entry to the table if SoapAction was explicitly set // on the SoapMethodAttribute. RegisterSoapActionForMethodBase(mi); } // register interop xml elements and types if specified SoapTypeAttribute attr = (SoapTypeAttribute) InternalRemotingServices.GetCachedSoapAttribute(type); if (attr.IsInteropXmlElement()) { RegisterInteropXmlElement(attr.XmlElementName, attr.XmlNamespace, type); } if (attr.IsInteropXmlType()) { RegisterInteropXmlType(attr.XmlTypeName, attr.XmlTypeNamespace, type); } // construct field maps for mapping xml elements and attributes back to // the correct type int mapCount = 0; XmlToFieldTypeMap map = new XmlToFieldTypeMap(); foreach (FieldInfo field in type.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)) { SoapFieldAttribute fieldAttr = (SoapFieldAttribute) InternalRemotingServices.GetCachedSoapAttribute(field); if (fieldAttr.IsInteropXmlElement()) { String xmlName = fieldAttr.XmlElementName; String xmlNamespace = fieldAttr.XmlNamespace; if (fieldAttr.UseAttribute) { map.AddXmlAttribute(field.FieldType, field.Name, xmlName, xmlNamespace); } else { map.AddXmlElement(field.FieldType, field.Name, xmlName, xmlNamespace); } mapCount++; } } // foreach field // add field map if there is more than one entry if (mapCount > 0) { _xmlToFieldTypeMap[type] = map; } } // PreLoad