次の方法で共有


DiscoveryDocumentReference.ResolveAll メソッド

探索ドキュメント内にあるすべての参照先ドキュメントが、有効かどうかを検証します。

Public Sub ResolveAll()
[C#]
public void ResolveAll();
[C++]
public: void ResolveAll();
[JScript]
public function ResolveAll();

例外

例外の種類 条件
InvalidOperationException ClientProtocol プロパティが null 参照 (Visual Basic では Nothing) です。

または

探索ドキュメントのダウンロードおよび検証が正常に実行されませんでした。

解説

DiscoveryDocumentReference オブジェクトのそれぞれの参照を解決する必要がない場合は、 DiscoveryClientProtocolResolveAll メソッドまたは ResolveOneLevel メソッドを呼び出します。

このメソッドは、 ClientProtocolReferences プロパティ内の探索ドキュメント、XSD スキーマ、サービスの説明へのすべての参照、および参照先の探索ドキュメントにあるすべての参照を解決します。

使用例

 
Imports System
Imports System.Web.Services.Discovery
Imports System.Collections
Imports MicroSoft.VisualBasic

Public Class DiscoveryDocumentReference_Document_ResolveAll
   
   Public Shared Sub Main()
      Try
         Dim myUrl As String = "https://localhost/Sample_vb.vsdisco"
         Dim myProtocol As New DiscoveryClientProtocol()
         ' Get the discovery document myDiscoveryDocument.
         Dim myDiscoveryDocument As DiscoveryDocument = myProtocol.Discover(myUrl)
         ' Get the references of myDiscoveryDocument.
         Dim myEnumerator As IEnumerator = myDiscoveryDocument.References.GetEnumerator()
         While myEnumerator.MoveNext()
            Dim myNewReference As DiscoveryDocumentReference = _ 
                                  CType(myEnumerator.Current, DiscoveryDocumentReference)
            ' Set the ClientProtocol of myNewReference.
            Dim myNewProtocol As DiscoveryClientProtocol = myNewReference.ClientProtocol
            ' Verify for all the valid references.
            myNewReference.ResolveAll()

            ' Get the document of myNewReference.
            Dim myNewDiscoveryDocument As DiscoveryDocument = myNewReference.Document
            Dim myNewEnumerator As IEnumerator = _ 
                                     myNewDiscoveryDocument.References.GetEnumerator()
            Console.WriteLine("The valid discovery document is : " + ControlChars.NewLine)
            While myNewEnumerator.MoveNext()
               ' Display the references of myNewDiscoveryDocument on the console.
               Console.WriteLine(CType(myNewEnumerator.Current, DiscoveryDocumentReference).Ref)
            End While
         End While
      Catch e As Exception
         Console.WriteLine("Exception :{0}", e.Message)
      End Try
   End Sub 'Main
End Class 'DiscoveryDocumentReference_Document_ResolveAll

[C#] 
using System;
using System.Web.Services.Discovery;
using System.Collections;

public class DiscoveryDocumentReference_Document_ResolveAll
{
   public static void Main()
   {
      try
      {
         string myUrl = "https://localhost/Sample_cs.vsdisco";
         DiscoveryClientProtocol myProtocol = new DiscoveryClientProtocol();
         // Get the discovery document myDiscoveryDocument.
         DiscoveryDocument myDiscoveryDocument = myProtocol.Discover(myUrl);
         // Get the references of myDiscoveryDocument.
         IEnumerator myEnumerator = myDiscoveryDocument.References.GetEnumerator();
         while(myEnumerator.MoveNext())
         {
            DiscoveryDocumentReference myNewReference = 
                           (DiscoveryDocumentReference)myEnumerator.Current;
            // Set the ClientProtocol of myNewReference.
            DiscoveryClientProtocol myNewProtocol = myNewReference.ClientProtocol;
            // Verify for all the valid references.
            myNewReference.ResolveAll();

            // Get the document of myNewReference.
            DiscoveryDocument myNewDiscoveryDocument = 
                                                 myNewReference.Document;

            IEnumerator myNewEnumerator = 
                           myNewDiscoveryDocument.References.GetEnumerator();
            Console.WriteLine("The valid discovery document is : \n");
            while(myNewEnumerator.MoveNext())
            {
               // Display the references of myNewDiscoveryDocument on the console.
               Console.WriteLine(((DiscoveryDocumentReference)myNewEnumerator.Current).Ref);
            }
         }
      }
      catch(Exception e)
      {
         Console.WriteLine("Exception :{0}", e.Message);
      }
   }
}

[C++] 
#using <mscorlib.dll>
#using <System.dll>
#using <System.Web.Services.dll>
using namespace System;
using namespace System::Web::Services::Discovery;
using namespace System::Collections;

int main() {
   try {
      String* myUrl = S"https://localhost/Sample_cs.vsdisco";
      DiscoveryClientProtocol* myProtocol = new DiscoveryClientProtocol();
      // Get the discovery document myDiscoveryDocument.
      DiscoveryDocument* myDiscoveryDocument = myProtocol->Discover(myUrl);
      // Get the references of myDiscoveryDocument.
      IEnumerator* myEnumerator = myDiscoveryDocument->References->GetEnumerator();
      while(myEnumerator->MoveNext()) {
         DiscoveryDocumentReference* myNewReference =
            dynamic_cast<DiscoveryDocumentReference*>(myEnumerator->Current);
         // Set the ClientProtocol of myNewReference.
         DiscoveryClientProtocol* myNewProtocol = myNewReference->ClientProtocol;
         // Verify for all the valid references.
         myNewReference->ResolveAll();

         // Get the document of myNewReference.
         DiscoveryDocument* myNewDiscoveryDocument =
            myNewReference->Document;

         IEnumerator* myNewEnumerator =
            myNewDiscoveryDocument->References->GetEnumerator();
         Console::WriteLine(S"The valid discovery document is : \n");
         while(myNewEnumerator->MoveNext()) {
            // Display the references of myNewDiscoveryDocument on the console.
            Console::WriteLine((dynamic_cast<DiscoveryDocumentReference*>(myNewEnumerator->Current))->Ref);
         }
      }
   } catch (Exception* e) {
      Console::WriteLine(S"Exception : {0}", e->Message);
   }
}

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

DiscoveryDocumentReference クラス | DiscoveryDocumentReference メンバ | System.Web.Services.Discovery 名前空間 | ResolveAll | DiscoveryClientProtocol | ResolveOneLevel