DiscoveryExceptionDictionary 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
XML Web services를 검색하는 동안 발생한 예외를 수집합니다. 이 클래스는 상속될 수 없습니다.
public ref class DiscoveryExceptionDictionary sealed : System::Collections::DictionaryBase
public sealed class DiscoveryExceptionDictionary : System.Collections.DictionaryBase
type DiscoveryExceptionDictionary = class
inherit DictionaryBase
Public NotInheritable Class DiscoveryExceptionDictionary
Inherits DictionaryBase
- 상속
예제
#using <System.Xml.dll>
#using <System.Web.Services.dll>
#using <System.dll>
using namespace System;
using namespace System::Web::Services::Discovery;
using namespace System::Xml;
using namespace System::Collections;
using namespace System::Runtime::Remoting;
using namespace System::Net;
int main()
{
String^ myDiscoFile = "http://localhost/MathService_cs.disco";
String^ myUrlKey = "http://localhost/MathService_cs.asmx?wsdl";
DiscoveryClientProtocol^ myDiscoveryClientProtocol1 = gcnew DiscoveryClientProtocol;
DiscoveryDocument^ myDiscoveryDocument = myDiscoveryClientProtocol1->Discover( myDiscoFile );
IEnumerator^ myEnumerator = myDiscoveryDocument->References->GetEnumerator();
while ( myEnumerator->MoveNext() )
{
ContractReference^ myContractReference = dynamic_cast<ContractReference^>(myEnumerator->Current);
DiscoveryClientProtocol^ myDiscoveryClientProtocol2 = myContractReference->ClientProtocol;
myDiscoveryClientProtocol2->ResolveAll();
DiscoveryExceptionDictionary^ myExceptionDictionary = myDiscoveryClientProtocol2->Errors;
if ( myExceptionDictionary->Contains( myUrlKey ) == true )
{
Console::WriteLine( "'myExceptionDictionary' contains a discovery exception for the key '{0}'", myUrlKey );
}
else
{
Console::WriteLine( "'myExceptionDictionary' does not contain a discovery exception for the key '{0}'", myUrlKey );
}
if ( myExceptionDictionary->Contains( myUrlKey ) == true )
{
Console::WriteLine( "System generated exceptions." );
Exception^ myException = myExceptionDictionary[ myUrlKey ];
Console::WriteLine( " Source : {0}", myException->Source );
Console::WriteLine( " Exception : {0}", myException->Message );
Console::WriteLine();
// Remove the discovery exception.for the key 'myUrlKey'.
myExceptionDictionary->Remove( myUrlKey );
DiscoveryExceptionDictionary^ myNewExceptionDictionary = gcnew DiscoveryExceptionDictionary;
// Add an exception with the custom error message.
Exception^ myNewException = gcnew Exception( "The requested service is not available." );
myNewExceptionDictionary->Add( myUrlKey, myNewException );
myExceptionDictionary = myNewExceptionDictionary;
Console::WriteLine( "Added exceptions." );
array<Object^>^myArray = gcnew array<Object^>(myExceptionDictionary->Count);
myExceptionDictionary->Keys->CopyTo( (Array^)myArray, 0 );
Console::WriteLine( " Keys are :" );
for each(Object^ myObj in myArray)
{
Console::WriteLine(" " + myObj->ToString());
}
Console::WriteLine();
array<Object^>^myCollectionArray = gcnew array<Object^>(myExceptionDictionary->Count);
myExceptionDictionary->Values->CopyTo( (Array^)myCollectionArray, 0 );
Console::WriteLine( " Values are :" );
for each(Object^ myObj in myCollectionArray)
{
Console::WriteLine(" " + myObj->ToString());
}
}
}
}
using System;
using System.Web.Services.Discovery;
using System.Xml;
using System.Collections;
using System.Runtime.Remoting;
using System.Net;
public class MySample
{
static void Main()
{
string myDiscoFile = "http://localhost/MathService_cs.disco";
string myUrlKey = "http://localhost/MathService_cs.asmx?wsdl";
DiscoveryClientProtocol myDiscoveryClientProtocol1 =
new DiscoveryClientProtocol();
DiscoveryDocument myDiscoveryDocument =
myDiscoveryClientProtocol1.Discover(myDiscoFile);
IEnumerator myEnumerator =
myDiscoveryDocument.References.GetEnumerator();
while ( myEnumerator.MoveNext() )
{
ContractReference myContractReference =
(ContractReference)myEnumerator.Current;
DiscoveryClientProtocol myDiscoveryClientProtocol2 =
myContractReference.ClientProtocol;
myDiscoveryClientProtocol2.ResolveAll();
DiscoveryExceptionDictionary myExceptionDictionary
= myDiscoveryClientProtocol2.Errors;
if ( myExceptionDictionary.Contains(myUrlKey) == true )
{
Console.WriteLine("'myExceptionDictionary' contains " +
" a discovery exception for the key '" + myUrlKey + "'");
}
else
{
Console.WriteLine("'myExceptionDictionary' does not contain" +
" a discovery exception for the key '" + myUrlKey + "'");
}
if (myExceptionDictionary.Contains(myUrlKey) == true )
{
Console.WriteLine("System generated exceptions.");
Exception myException = myExceptionDictionary[myUrlKey];
Console.WriteLine(" Source : " + myException.Source);
Console.WriteLine(" Exception : " + myException.Message);
Console.WriteLine();
// Remove the discovery exception.for the key 'myUrlKey'.
myExceptionDictionary.Remove(myUrlKey);
DiscoveryExceptionDictionary myNewExceptionDictionary =
new DiscoveryExceptionDictionary();
// Add an exception with the custom error message.
Exception myNewException =
new Exception("The requested service is not available.");
myNewExceptionDictionary.Add(myUrlKey, myNewException);
myExceptionDictionary = myNewExceptionDictionary;
Console.WriteLine("Added exceptions.");
object[] myArray = new object[myExceptionDictionary.Count];
myExceptionDictionary.Keys.CopyTo((Array)myArray,0);
Console.WriteLine(" Keys are :");
foreach(object myObj in myArray)
{
Console.WriteLine(" " + myObj.ToString());
}
Console.WriteLine();
object[] myCollectionArray = new object[myExceptionDictionary.Count];
myExceptionDictionary.Values.CopyTo((Array)myCollectionArray,0);
Console.WriteLine(" Values are :");
foreach(object myObj in myCollectionArray)
{
Console.WriteLine(" " + myObj.ToString());
}
}
}
}
}
Imports System.Web.Services.Discovery
Imports System.Xml
Imports System.Collections
Imports System.Runtime.Remoting
Imports System.Net
Public Class MySample
Shared Sub Main()
Dim myDiscoFile As String = "http://localhost/MathService_vb.disco"
Dim myUrlKey As String = "http://localhost/MathService_vb.asmx?wsdl"
Dim myDiscoveryClientProtocol1 As New DiscoveryClientProtocol()
Dim myDiscoveryDocument As DiscoveryDocument = myDiscoveryClientProtocol1.Discover(myDiscoFile)
Dim myEnumerator As IEnumerator = myDiscoveryDocument.References.GetEnumerator()
While myEnumerator.MoveNext()
Dim myContractReference As ContractReference = CType(myEnumerator.Current, ContractReference)
Dim myDiscoveryClientProtocol2 As DiscoveryClientProtocol = myContractReference.ClientProtocol
myDiscoveryClientProtocol2.ResolveAll()
Dim myExceptionDictionary As DiscoveryExceptionDictionary = myDiscoveryClientProtocol2.Errors
If myExceptionDictionary.Contains(myUrlKey) = True Then
Console.WriteLine("'myExceptionDictionary' contains " + _
"a discovery exception for the key '" + myUrlKey + "'")
Else
Console.WriteLine("'myExceptionDictionary' does not contain" + _
" a discovery exception for the key '" + myUrlKey + "'")
End If
If myExceptionDictionary.Contains(myUrlKey) = True Then
Console.WriteLine("System generated exceptions.")
Dim myException As Exception = myExceptionDictionary(myUrlKey)
Console.WriteLine(" Source : " + myException.Source)
Console.WriteLine(" Exception : " + myException.Message)
Console.WriteLine()
' Remove the discovery exception.for the key 'myUrlKey'.
myExceptionDictionary.Remove(myUrlKey)
Dim myNewExceptionDictionary As New DiscoveryExceptionDictionary()
' Add an exception with the custom error message.
Dim myNewException As New Exception("The requested service is not available.")
myNewExceptionDictionary.Add(myUrlKey, myNewException)
myExceptionDictionary = myNewExceptionDictionary
Console.WriteLine("Added exceptions.")
Dim myArray(myExceptionDictionary.Count -1 ) As Object
myExceptionDictionary.Keys.CopyTo(CType(myArray, Array), 0)
Console.WriteLine(" Keys are :")
Dim myObj As Object
For Each myObj In myArray
Console.WriteLine(" " + myObj.ToString())
Next myObj
Console.WriteLine()
Dim myCollectionArray(myExceptionDictionary.Count -1 ) As Object
myExceptionDictionary.Values.CopyTo(CType(myCollectionArray, Array), 0)
Console.WriteLine(" Values are :")
For Each myObj In myCollectionArray
Console.WriteLine(" " + myObj.ToString())
Next myObj
End If
End While
End Sub
End Class
설명
합니다 Errors 속성을 DiscoveryClientProtocol 유형의 DiscoveryExceptionDictionary합니다.
생성자
DiscoveryExceptionDictionary() |
DiscoveryExceptionDictionary 클래스의 새 인스턴스를 초기화합니다. |
속성
Count |
DictionaryBase 인스턴스에 포함된 요소 수를 가져옵니다. (다음에서 상속됨 DictionaryBase) |
Dictionary |
DictionaryBase 인스턴스에 포함된 요소의 목록을 가져옵니다. (다음에서 상속됨 DictionaryBase) |
InnerHashtable |
DictionaryBase 인스턴스에 포함된 요소의 목록을 가져옵니다. (다음에서 상속됨 DictionaryBase) |
Item[String] |
Exception에서 지정된 URL을 검색하는 동안 발생한 DiscoveryExceptionDictionary을 가져오거나 설정합니다. |
Keys |
ICollection에 있는 모든 키가 포함된 DiscoveryExceptionDictionary 개체를 가져옵니다. |
Values |
ICollection에 있는 모든 값이 포함된 DiscoveryExceptionDictionary 개체를 가져옵니다. |
메서드
명시적 인터페이스 구현
확장 메서드
Cast<TResult>(IEnumerable) |
IEnumerable의 요소를 지정된 형식으로 캐스팅합니다. |
OfType<TResult>(IEnumerable) |
지정된 형식에 따라 IEnumerable의 요소를 필터링합니다. |
AsParallel(IEnumerable) |
쿼리를 병렬화할 수 있도록 합니다. |
AsQueryable(IEnumerable) |
IEnumerable을 IQueryable로 변환합니다. |