SoapIncludeAttribute クラス
アセンブリ: System.Xml (system.xml.dll 内)

<AttributeUsageAttribute(AttributeTargets.Class Or AttributeTargets.Struct Or AttributeTargets.Method Or AttributeTargets.Interface, AllowMultiple:=True)> _ Public Class SoapIncludeAttribute Inherits Attribute
[AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Method|AttributeTargets.Interface, AllowMultiple=true)] public class SoapIncludeAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Class|AttributeTargets::Struct|AttributeTargets::Method|AttributeTargets::Interface, AllowMultiple=true)] public ref class SoapIncludeAttribute : public Attribute

SoapIncludeAttribute クラスは、XmlSerializer がオブジェクトをエンコード済み SOAP XML としてシリアル化または逆シリアル化する方法を制御する一連の属性のうちの 1 つです。結果として生成される XML は、W3C (World Wide Web Consortium) (www.w3.org) のドキュメント『Simple Object Access Protocol (SOAP) 1.1』のセクション 5 に準拠します。類似する属性の完全な一覧については、「エンコード済み SOAP シリアル化を制御する属性」を参照してください。
オブジェクトをエンコード済み SOAP メッセージとしてシリアル化するには、SoapReflectionImporter クラスの ImportTypeMapping メソッドで作成された XmlTypeMapping を使用して、XmlSerializer を構築する必要があります。
SoapIncludeAttribute を適用するときには、派生クラスの Type を指定します。XmlSerializer は、基本クラスと派生クラスの両方を含むオブジェクトをシリアル化する場合は、両方のオブジェクト型を認識できます。
Web サービス記述言語 (WSDL: Web Services Description Language) で記述されたサービスの説明ドキュメントに派生クラスを含める場合は、SoapIncludeAttribute を使用します。たとえば、メソッドが Object を返す場合は、そのメソッドに SoapIncludeAttribute を適用し、実際に返される必要がある型を指定します。
WSDL の詳細については、W3C (World Wide Web Consortium) (www.w3.org) の仕様『Web Services Description Language (WSDL) 1.1』を参照してください。

SoapIncludeAttribute を XML Web サービス メソッドに 2 回適用する例を次に示します。このメソッドは、オブジェクト型 Vehicle (基本クラス) を返します。SoapIncludeAttribute が適用されているため、このメソッドは Vehicle クラスから派生したクラスのインスタンスを返すことができます。
<%@ WebService Language="VB" Class="Test" %> Imports System Imports System.Web.Services Imports System.Web.Services.Protocols Imports System.Web.Services.Description Imports System.Xml Imports System.Xml.Schema Imports System.Xml.Serialization Imports System.Data Public Class Test : Inherits WebService <WebMethod()> Public Function EchoString( _ <XmlElement(DataType:="string")> ByVal strval As String) _ As <XmlElement("MyTime", DataType:="time")> DateTime Return DateTime.Now End Function <WebMethod(), SoapRpcMethod, SoapInclude(GetType(Car)), _ SoapInclude(GetType(Bike))> _ Public Function Vehicle (licenseNumber As string ) As Vehicle If licenseNumber = "0" Then Dim v As Vehicle = new Car() v.licenseNumber = licenseNumber return v ElseIf licenseNumber = "1" Then Dim v As Vehicle = new Bike() v.licenseNumber = licenseNumber return v else return Nothing End If End Function End Class <XmlRoot("NewVehicle")> _ public MustInherit Class Vehicle public licenseNumber As String public make As DateTime End Class public class Car Inherits Vehicle End Class public Class Bike Inherits Vehicle End Class
<%@ WebService Language="C#" Class="Test" %> using System; using System.Web.Services; using System.Web.Services.Protocols; using System.Web.Services.Description; using System.Xml; using System.Xml.Schema; using System.Xml.Serialization; using System.Data; public class Test : WebService { [WebMethod()] [return:XmlElement("MyTime", DataType="time")] public DateTime EchoString([XmlElement(DataType="string")] string strval) { return DateTime.Now; } [WebMethod()] [SoapRpcMethod] [SoapInclude(typeof(Car)), SoapInclude(typeof(Bike))] public Vehicle Vehicle(string licenseNumber) { if (licenseNumber == "0") { Vehicle v = new Car(); v.licenseNumber = licenseNumber; return v; } else if (licenseNumber == "1") { Vehicle v = new Bike(); v.licenseNumber = licenseNumber; return v; } else { return null; } } } [XmlRoot("NewVehicle")] public abstract class Vehicle { public string licenseNumber; public DateTime make; } public class Car : Vehicle { } public class Bike : Vehicle { }
<%@ WebService Language="VJ#" Class="Test" %> import System.*; import System.Web.Services.*; import System.Web.Services.Protocols.*; import System.Web.Services.Description.*; import System.Xml.*; import System.Xml.Schema.*; import System.Xml.Serialization.*; import System.Data.*; public class Test extends WebService { /** @attribute WebMethod() */ public DateTime EchoString( /** @attribute XmlElement(DataType = "string") */ String strval) { return DateTime.get_Now(); } //EchoString /** @attribute WebMethod() */ /** @attribute SoapRpcMethod() */ /** @attribute SoapInclude(Car.class) @attribute SoapInclude(Bike.class) */ public Vehicle Vehicle(String licenseNumber) { if (licenseNumber.Equals("0")) { Vehicle v = new Car(); v.licenseNumber = licenseNumber; return v; } else { if (licenseNumber.Equals("1")) { Vehicle v = new Bike(); v.licenseNumber = licenseNumber; return v; } else { return null; } } } //Vehicle } //Test /** @attribute XmlRoot("NewVehicle") */ abstract public class Vehicle { public String licenseNumber; public DateTime make; } //Vehicle public class Car extends Vehicle { } //Car public class Bike extends Vehicle { } //Bike

System.Attribute
System.Xml.Serialization.SoapIncludeAttribute


Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


SoapIncludeAttribute コンストラクタ
アセンブリ: System.Xml (system.xml.dll 内)


SoapIncludeAttribute の複数のインスタンスを、オブジェクトの配列 (オブジェクトのコレクションを格納した ArrayList) を返すフィールドまたはプロパティか、複数の型を返すことのできるオブジェクトを返すフィールドまたはプロパティに適用します。フィールドまたはプロパティに含める型ごとに、Type プロパティを設定します。

SoapIncludeAttribute を XML Web サービス メソッドに 2 回適用する例を次に示します。このメソッドは、オブジェクト型 Vehicle (基本クラス) を返します。SoapIncludeAttribute が適用されているため、このメソッドは Vehicle クラスから派生したクラスのインスタンスを返すことができます。
<%@ WebService Language="VB" Class="Test" %> Imports System Imports System.Web.Services Imports System.Web.Services.Protocols Imports System.Web.Services.Description Imports System.Xml Imports System.Xml.Schema Imports System.Xml.Serialization Imports System.Data Public Class Test : Inherits WebService <WebMethod()> Public Function EchoString( _ <XmlElement(DataType:="string")> ByVal strval As String) _ As <XmlElement("MyTime", DataType:="time")> DateTime Return DateTime.Now End Function <WebMethod(), SoapRpcMethod, SoapInclude(GetType(Car)), _ SoapInclude(GetType(Bike))> _ Public Function Vehicle (licenseNumber As string ) As Vehicle If licenseNumber = "0" Then Dim v As Vehicle = new Car() v.licenseNumber = licenseNumber return v ElseIf licenseNumber = "1" Then Dim v As Vehicle = new Bike() v.licenseNumber = licenseNumber return v else return Nothing End If End Function End Class <XmlRoot("NewVehicle")> _ public MustInherit Class Vehicle public licenseNumber As String public make As DateTime End Class public class Car Inherits Vehicle End Class public Class Bike Inherits Vehicle End Class
<%@ WebService Language="C#" Class="Test" %> using System; using System.Web.Services; using System.Web.Services.Protocols; using System.Web.Services.Description; using System.Xml; using System.Xml.Schema; using System.Xml.Serialization; using System.Data; public class Test : WebService { [WebMethod()] [return:XmlElement("MyTime", DataType="time")] public DateTime EchoString([XmlElement(DataType="string")] string strval) { return DateTime.Now; } [WebMethod()] [SoapRpcMethod] [SoapInclude(typeof(Car)), SoapInclude(typeof(Bike))] public Vehicle Vehicle(string licenseNumber) { if (licenseNumber == "0") { Vehicle v = new Car(); v.licenseNumber = licenseNumber; return v; } else if (licenseNumber == "1") { Vehicle v = new Bike(); v.licenseNumber = licenseNumber; return v; } else { return null; } } } [XmlRoot("NewVehicle")] public abstract class Vehicle { public string licenseNumber; public DateTime make; } public class Car : Vehicle { } public class Bike : Vehicle { }
<%@ WebService Language="VJ#" Class="Test" %> import System.*; import System.Web.Services.*; import System.Web.Services.Protocols.*; import System.Web.Services.Description.*; import System.Xml.*; import System.Xml.Schema.*; import System.Xml.Serialization.*; import System.Data.*; public class Test extends WebService { /** @attribute WebMethod() */ public DateTime EchoString( /** @attribute XmlElement(DataType = "string") */ String strval) { return DateTime.get_Now(); } //EchoString /** @attribute WebMethod() */ /** @attribute SoapRpcMethod() */ /** @attribute SoapInclude(Car.class) @attribute SoapInclude(Bike.class) */ public Vehicle Vehicle(String licenseNumber) { if (licenseNumber.Equals("0")) { Vehicle v = new Car(); v.licenseNumber = licenseNumber; return v; } else { if (licenseNumber.Equals("1")) { Vehicle v = new Bike(); v.licenseNumber = licenseNumber; return v; } else { return null; } } } //Vehicle } //Test /** @attribute XmlRoot("NewVehicle") */ abstract public class Vehicle { public String licenseNumber; public DateTime make; } //Vehicle public class Car extends Vehicle { } //Car public class Bike extends Vehicle { } //Bike

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


SoapIncludeAttribute プロパティ
SoapIncludeAttribute メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 ( Attribute から継承されます。) |
![]() | GetCustomAttribute | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 ( Attribute から継承されます。) |
![]() | GetCustomAttributes | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 ( Attribute から継承されます。) |
![]() | GetHashCode | このインスタンスのハッシュ コードを返します。 ( Attribute から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | IsDefaultAttribute | 派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 ( Attribute から継承されます。) |
![]() | IsDefined | オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 ( Attribute から継承されます。) |
![]() | Match | 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 ( Attribute から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

SoapIncludeAttribute メンバ
XmlSerializer がオブジェクトをエンコード済みの SOAP XML としてシリアル化または逆シリアル化するときに、型を認識できるようにします。
SoapIncludeAttribute データ型で公開されるメンバを以下の表に示します。



名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 ( Attribute から継承されます。) |
![]() | GetCustomAttribute | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 (Attribute から継承されます。) |
![]() | GetCustomAttributes | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 (Attribute から継承されます。) |
![]() | GetHashCode | このインスタンスのハッシュ コードを返します。 (Attribute から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | IsDefaultAttribute | 派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 (Attribute から継承されます。) |
![]() | IsDefined | オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 (Attribute から継承されます。) |
![]() | Match | 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 (Attribute から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

Weblioに収録されているすべての辞書からSoapIncludeAttributeを検索する場合は、下記のリンクをクリックしてください。

- SoapIncludeAttributeのページへのリンク