ContractReference 클래스

정의

서비스 설명에 대한 검색 문서의 참조를 나타냅니다.

public ref class ContractReference : System::Web::Services::Discovery::DiscoveryReference
public class ContractReference : System.Web.Services.Discovery.DiscoveryReference
type ContractReference = class
    inherit DiscoveryReference
Public Class ContractReference
Inherits DiscoveryReference
상속
ContractReference

예제

#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 );
   }

}
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);
      }
   }
}
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
End Class

설명

XML 웹 서비스 검색에는 URL이 지정된 사용 가능한 웹 서비스를 검색하는 작업이 포함됩니다. URL은 일반적으로 a.disco 파일 이름 확장명을 가진 검색 문서를 가리킵니다. 검색 문서 내에는 XML 웹 서비스의 존재에 대한 정보에 대한 참조가 있습니다. 이러한 참조는 서비스 설명, XSD(XML 스키마 정의 언어) 스키마 또는 기타 검색 문서를 참조할 수 있습니다. 이 클래스는 서비스 설명에 대한 참조를 나타냅니다.

검색 문서 내에서 서비스 설명에 대한 참조는 XML 요소 내에 contractRef 포함됩니다. contractRef XML 요소에는 및 docRef의 두 가지 특성이 ref 있습니다. 요소에는 contractRef 상수와 일치하는 Namespace XML 네임스페이스가 있어야 하는 반면 refdocRef 특성은 및 DocRef 속성에 Ref 배치됩니다.

생성자

ContractReference()

기본값을 사용하여 ContractReference 클래스의 새 인스턴스를 초기화합니다.

ContractReference(String)

서비스 설명에 대한 제공된 참조를 사용하여 ContractReference 클래스의 새 인스턴스를 초기화합니다.

ContractReference(String, String)

서비스 설명과 이 서비스 설명을 구현하는 XML Web services에 대한 제공된 참조를 사용하여 ContractReference 클래스의 새 인스턴스를 초기화합니다.

필드

Namespace

검색 문서에 있는 서비스 설명 참조에 대한 XML 네임스페이스입니다.

속성

ClientProtocol

검색 프로세스에서 사용되는 DiscoveryClientProtocol의 인스턴스를 가져오거나 설정합니다.

(다음에서 상속됨 DiscoveryReference)
Contract

서비스 설명을 나타내는 ServiceDescription 개체를 가져옵니다.

DefaultFilename

참조된 서비스 설명을 저장할 때 기본적으로 사용할 파일의 이름을 가져옵니다.

DocRef

Ref 속성에 참조된 서비스 설명을 구현하는 XML Web services에 대한 URL을 가져오거나 설정합니다.

Ref

참조된 서비스 설명에 대한 URL을 가져오거나 설정합니다.

Url

참조된 서비스 설명에 대한 URL을 가져오거나 설정합니다.

메서드

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ReadDocument(Stream)

전달된 Stream에서 서비스 설명을 읽고 서비스 설명을 반환합니다.

Resolve()

참조된 문서가 유효한지 여부를 확인하기 위해 Url에 있는 참조된 문서를 다운로드합니다.

(다음에서 상속됨 DiscoveryReference)
Resolve(String, Stream)

참조된 문서가 유효한지 여부를 확인합니다.

ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)
WriteDocument(Object, Stream)

전달된 서비스 설명을 전달된 Stream에 씁니다.

적용 대상

추가 정보