Edit

Share via


SoapServices.RegisterInteropXmlType(String, String, Type) Method

Definition

Associates the given XML type name and namespace with the run-time type that should be used for deserialization.

public:
 static void RegisterInteropXmlType(System::String ^ xmlType, System::String ^ xmlTypeNamespace, Type ^ type);
public static void RegisterInteropXmlType (string xmlType, string xmlTypeNamespace, Type type);
[System.Security.SecurityCritical]
public static void RegisterInteropXmlType (string xmlType, string xmlTypeNamespace, Type type);
static member RegisterInteropXmlType : string * string * Type -> unit
[<System.Security.SecurityCritical>]
static member RegisterInteropXmlType : string * string * Type -> unit
Public Shared Sub RegisterInteropXmlType (xmlType As String, xmlTypeNamespace As String, type As Type)

Parameters

xmlType
String

The XML type to use in deserialization.

xmlTypeNamespace
String

The XML namespace to use in deserialization.

type
Type

The run-time Type to use in deserialization.

Attributes

Exceptions

The immediate caller does not have infrastructure permission.

Examples

The following code example shows how to use this method. This code example is part of a larger example provided for the SoapServices class.

// Get the currently registered type for the given XML element
// and namespace.
String^ registeredXmlTypeName = L"ExampleXmlTypeName";
String^ registeredXmlTypeNamespace =
   L"http://example.org/ExampleXmlTypeNamespace";
registeredType = SoapServices::GetInteropTypeFromXmlType(
   registeredXmlTypeName, registeredXmlTypeNamespace );
Console::WriteLine( L"The registered interop type is {0}.",
   registeredType );

// Register a new type for the XML element and namespace.
SoapServices::RegisterInteropXmlType( registeredXmlTypeName,
   registeredXmlTypeNamespace,String::typeid );

// Get the currently registered type for the given XML element
// and namespace.
registeredType = SoapServices::GetInteropTypeFromXmlType(
   registeredXmlTypeName,registeredXmlTypeNamespace );
Console::WriteLine( L"The registered interop type is {0}.",
   registeredType );
// Get the currently registered type for the given XML element 
// and namespace.
string registeredXmlTypeName = 
    "ExampleXmlTypeName";
string registeredXmlTypeNamespace = 
    "http://example.org/ExampleXmlTypeNamespace";
registeredType = 
    SoapServices.GetInteropTypeFromXmlType(
    registeredXmlTypeName, 
    registeredXmlTypeNamespace);
Console.WriteLine(
    "The registered interop type is {0}.",
    registeredType);

// Register a new type for the XML element and namespace.
SoapServices.RegisterInteropXmlType(
    registeredXmlTypeName,
    registeredXmlTypeNamespace, 
    typeof(String));

// Get the currently registered type for the given XML element 
// and namespace.
registeredType = 
    SoapServices.GetInteropTypeFromXmlType(
    registeredXmlTypeName, 
    registeredXmlTypeNamespace);
Console.WriteLine(
    "The registered interop type is {0}.",
    registeredType);

Applies to