ContractReference クラス
アセンブリ: System.Web.Services (system.web.services.dll 内)


XML Web サービス探索には、指定 URL で使用できる Web サービスの探索が含まれます。通常、URL は探索ドキュメントを指します。探索ドキュメントのファイル名拡張子は通常 .disco です。探索ドキュメントには、XML Web サービスが存在するかどうかに関する情報への参照が含まれています。これらの参照は、サービスの説明、XML スキーマ定義言語 (XSD) スキーマ、または他の探索ドキュメントを参照できます。このクラスは、サービスの説明への参照を表します。
探索ドキュメント内では、サービスの説明への参照は contractRef XML 要素に格納されています。contractRef XML 要素には ref と docRef の 2 つの属性があります。contractRef 要素は Namespace 定数と一致する XML 名前空間を持っている必要がありますが、ref 属性と docRef 属性は Ref プロパティと DocRef プロパティに設定されます。

Imports System Imports System.Xml Imports System.IO Imports System.Web.Services.Discovery Public Class MyContractReference Shared Sub Main() Try ' Get a 'DiscoveryDocument' object. Dim myDiscoveryDocument As New DiscoveryDocument() ' Get a 'ContractReference' object. Dim myContractReference As New ContractReference() ' Set the URL to the referenced service description. myContractReference.Ref = "http://localhost/service1.asmx?wsdl" ' Set the URL for a XML Web service implementing the service ' description . myContractReference.DocRef = "http://localhost/service1.asmx" Dim myBinding As New SoapBinding() myBinding.Binding = New XmlQualifiedName("q1:Service1Soap") myBinding.Address = "http://localhost/service1.asmx" ' Add 'myContractReference' to the list of references contained ' within the discovery document. myDiscoveryDocument.References.Add(myContractReference) ' Add 'Binding' to referenceCollection. myDiscoveryDocument.References.Add(myBinding) ' Open or create a file for writing . Dim myFileStream As New FileStream("Service1.disco", FileMode.OpenOrCreate, FileAccess.Write) Dim myStreamWriter As New StreamWriter(myFileStream) ' Write 'myDiscoveryDocument' into the passed stream. myDiscoveryDocument.Write(myStreamWriter) Console.WriteLine("The 'Service1.disco' is generated.") Catch e As Exception Console.WriteLine("Error is" + e.Message) End Try End Sub 'Main End Class 'MyContractReference
using System; using System.Xml; using System.IO; using System.Web.Services.Discovery; public class MyContractReference { static void Main() { try { // Get a DiscoveryDocument. DiscoveryDocument myDiscoveryDocument = new DiscoveryDocument(); // Get a ContractReference. ContractReference myContractReference = new ContractReference(); // Set the URL to the referenced service description. myContractReference.Ref = "http://localhost/service1.asmx?wsdl"; // Set the URL for an XML Web service implementing the service // description. myContractReference.DocRef = "http://localhost/service1.asmx"; SoapBinding myBinding = new SoapBinding(); myBinding.Binding = new XmlQualifiedName("q1:Service1Soap"); myBinding.Address = "http://localhost/service1.asmx"; // Add myContractReference to the list of references contained // in the discovery document. myDiscoveryDocument.References.Add(myContractReference); // Add Binding to the references collection. myDiscoveryDocument.References.Add(myBinding); // Open or create a file for writing. FileStream myFileStream = new FileStream("Service1.disco" , FileMode.OpenOrCreate, FileAccess.Write ); StreamWriter myStreamWriter = new StreamWriter( myFileStream ); // Write myDiscoveryDocument into the passed stream. myDiscoveryDocument.Write( myStreamWriter ); Console.WriteLine("The Service1.disco is generated."); } catch(Exception e) { Console.WriteLine("Error is "+ e.Message); } } }
#using <System.Xml.dll> #using <System.Web.Services.dll> using namespace System; using namespace System::Xml; using namespace System::IO; using namespace System::Web::Services::Discovery; int main() { try { // Get a DiscoveryDocument. DiscoveryDocument^ myDiscoveryDocument = gcnew DiscoveryDocument; // Get a ContractReference. ContractReference^ myContractReference = gcnew ContractReference; // Set the URL to the referenced service description. myContractReference->Ref = "http://localhost/service1.asmx?wsdl"; // Set the URL for an XML Web service implementing the service // description. myContractReference->DocRef = "http://localhost/service1.asmx"; SoapBinding^ myBinding = gcnew SoapBinding; myBinding->Binding = gcnew XmlQualifiedName( "q1:Service1Soap" ); myBinding->Address = "http://localhost/service1.asmx"; // Add myContractReference to the list of references contained // in the discovery document. myDiscoveryDocument->References->Add( myContractReference ); // Add Binding to the references collection. myDiscoveryDocument->References->Add( myBinding ); // Open or create a file for writing. FileStream^ myFileStream = gcnew FileStream( "Service1.disco",FileMode::OpenOrCreate,FileAccess::Write ); StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); // Write myDiscoveryDocument into the passed stream. myDiscoveryDocument->Write( myStreamWriter ); Console::WriteLine( "The Service1.disco is generated." ); } catch ( Exception^ e ) { Console::WriteLine( "Error is {0}", e->Message ); } }
import System.*; import System.Xml.*; import System.IO.*; import System.Web.Services.Discovery.*; public class MyContractReference { public static void main(String[] args) { try { // Get a DiscoveryDocument. DiscoveryDocument myDiscoveryDocument = new DiscoveryDocument(); // Get a ContractReference. ContractReference myContractReference = new ContractReference(); // Set the URL to the referenced service description. myContractReference.set_Ref("http://localhost/service1.asmx?wsdl"); // Set the URL for an XML Web service implementing the service // description. myContractReference.set_DocRef("http://localhost/service1.asmx"); SoapBinding myBinding = new SoapBinding(); myBinding.set_Binding(new XmlQualifiedName("q1:Service1Soap")); myBinding.set_Address("http://localhost/service1.asmx"); // Add myContractReference to the list of references contained // in the discovery document. myDiscoveryDocument.get_References().Add(myContractReference); // Add Binding to the references collection. myDiscoveryDocument.get_References().Add(myBinding); // Open or create a file for writing. FileStream myFileStream = new FileStream("Service1.disco" , FileMode.OpenOrCreate, FileAccess.Write); StreamWriter myStreamWriter = new StreamWriter(myFileStream); // Write myDiscoveryDocument into the passed stream. myDiscoveryDocument.Write(myStreamWriter); Console.WriteLine("The Service1.disco is generated."); } catch (System.Exception e) { Console.WriteLine("Error is " + e.get_Message()); } } //main } //MyContractReference

System.Web.Services.Discovery.DiscoveryReference
System.Web.Services.Discovery.ContractReference


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


ContractReference コンストラクタ ()
アセンブリ: System.Web.Services (system.web.services.dll 内)



ContractReference の新しいインスタンスを作成するコード例を次に示します。
' Call the Constructor of ContractReference. Dim myContractReference As New ContractReference()
// Call the Constructor of ContractReference. ContractReference myContractReference = new ContractReference();
// Call the Constructor of ContractReference.
ContractReference^ myContractReference = gcnew ContractReference;
// Call the Constructor of ContractReference. ContractReference myContractReference = new ContractReference();

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


ContractReference コンストラクタ (String)
アセンブリ: System.Web.Services (system.web.services.dll 内)


このコンストラクタを使用して、指定した参照名で ContractReference クラスの新しいインスタンスを作成し、初期化します。
ContractReference のインスタンスの初期プロパティ値を次の表に示します。

'Create a ContractReference using a reference to a service description. Dim myContractReference As _ New ContractReference("http://localhost/Service1.asmx?wsdl")
// Create a ContractReference using a reference to a service description. ContractReference myContractReference = new ContractReference ("http://localhost/Service1.asmx?wsdl");

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


ContractReference コンストラクタ (String, String)
アセンブリ: System.Web.Services (system.web.services.dll 内)


このコンストラクタを使用して、指定した参照名と docRef で ContractReference クラスの新しいインスタンスを作成し、初期化します。
ContractReference のインスタンスの初期プロパティ値を次の表に示します。

' Create a ContractReference using a service description ' and an XML Web service. Dim myContractReference As New ContractReference _ ("http://localhost/Service1.asmx?wsdl", _ "http://localhost/Service1.asmx")
// Create a ContractReference using a service description and // an XML Web service. ContractReference myContractReference = new ContractReference ("http://localhost/Service1.asmx?wsdl", "http://localhost/Service1.asmx");

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


ContractReference コンストラクタ

名前 | 説明 |
---|---|
ContractReference () | 既定値を使用して ContractReference クラスの新しいインスタンスを初期化します。 |
ContractReference (String) | サービスの説明への参照を指定して、ContractReference の新しいインスタンスを初期化します。 |
ContractReference (String, String) | サービスの説明への参照、およびサービスの説明を実装している XML Web サービスを指定して、ContractReference クラスの新しいインスタンスを初期化します。 |

ContractReference フィールド
ContractReference プロパティ

名前 | 説明 | |
---|---|---|
![]() | ClientProtocol | 探索処理で使用する DiscoveryClientProtocol のインスタンスを取得または設定します。 ( DiscoveryReference から継承されます。) |
![]() | Contract | サービスの説明を表す System.Web.Services.Description.ServiceDescription オブジェクトを取得します。 |
![]() | DefaultFilename | オーバーライドされます。 参照先のサービスの説明を保存するときに使用する既定のファイル名を取得します。 |
![]() | DocRef | Ref プロパティで参照されるサービスの説明を実装している XML Web サービスの URL を取得または設定します。 |
![]() | Ref | 参照されるサービスの説明の場所を示す URL を取得または設定します。 |
![]() | Url | オーバーライドされます。 参照されるサービスの説明の場所を示す URL を取得または設定します。 |

ContractReference メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) |
![]() | FilenameFromUrl | 渡された URL に基づいてファイル名を返します。 ( DiscoveryReference から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | ReadDocument | オーバーライドされます。 渡された Stream からサービスの説明を読み取り、サービスの説明を返します。 |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | Resolve | オーバーロードされます。 |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |
![]() | WriteDocument | オーバーライドされます。 渡された Stream に渡されたサービスの説明を書き込みます。 |

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

ContractReference メンバ
ContractReference データ型で公開されるメンバを以下の表に示します。



名前 | 説明 | |
---|---|---|
![]() | ClientProtocol | 探索処理で使用する DiscoveryClientProtocol のインスタンスを取得または設定します。(DiscoveryReference から継承されます。) |
![]() | Contract | サービスの説明を表す System.Web.Services.Description.ServiceDescription オブジェクトを取得します。 |
![]() | DefaultFilename | オーバーライドされます。 参照先のサービスの説明を保存するときに使用する既定のファイル名を取得します。 |
![]() | DocRef | Ref プロパティで参照されるサービスの説明を実装している XML Web サービスの URL を取得または設定します。 |
![]() | Ref | 参照されるサービスの説明の場所を示す URL を取得または設定します。 |
![]() | Url | オーバーライドされます。 参照されるサービスの説明の場所を示す URL を取得または設定します。 |

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
![]() | FilenameFromUrl | 渡された URL に基づいてファイル名を返します。 (DiscoveryReference から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | ReadDocument | オーバーライドされます。 渡された Stream からサービスの説明を読み取り、サービスの説明を返します。 |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | Resolve | オーバーロードされます。 |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |
![]() | WriteDocument | オーバーライドされます。 渡された Stream に渡されたサービスの説明を書き込みます。 |

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

- ContractReferenceのページへのリンク