다음을 통해 공유


ContractReference.ReadDocument(Stream) 메서드

정의

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

public:
 override System::Object ^ ReadDocument(System::IO::Stream ^ stream);
public override object ReadDocument (System.IO.Stream stream);
override this.ReadDocument : System.IO.Stream -> obj
Public Overrides Function ReadDocument (stream As Stream) As Object

매개 변수

stream
Stream

서비스 설명을 포함하는 Stream입니다.

반환

Object

참조된 서비스 설명의 콘텐츠를 포함하는 ServiceDescription입니다.

예제

int main()
{
   try
   {
      // Create the file stream.
      FileStream^ wsdlStream = gcnew FileStream( "MyService1_cpp.wsdl",FileMode::Open );
      ContractReference^ myContractReference = gcnew ContractReference;
      
      // Read the service description from the passed stream.
      ServiceDescription^ myServiceDescription = dynamic_cast<ServiceDescription^>(myContractReference->ReadDocument( wsdlStream ));
      Console::Write( "Target Namespace for the service description is: {0}", myServiceDescription->TargetNamespace );
      wsdlStream->Close();
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( "Exception: {0}", e->Message );
   }
}
class MyClass1
{
   static void Main()
   {
      try
      {
         // Create the file stream.
         FileStream wsdlStream = new FileStream("MyService1_cs.wsdl",
             FileMode.Open);
         ContractReference myContractReference=new ContractReference();

         // Read the service description from the passed stream.
         ServiceDescription myServiceDescription=
             (ServiceDescription)myContractReference.ReadDocument(wsdlStream);
         Console.Write("Target Namespace for the service description is: "
             + myServiceDescription.TargetNamespace);
         wsdlStream.Close();
      }
      catch(Exception e)
      {
         Console.WriteLine("Exception: "+e.Message);
      }
   }
}
Class MyClass1
   
   Shared Sub Main()
      Try
         ' Create the file stream.
         Dim wsdlStream As _
             New FileStream("MyService1_vb.wsdl", FileMode.Open)
         Dim myContractReference As New ContractReference()

         ' Read the service description from the passed stream.
         Dim myServiceDescription As ServiceDescription = _
             CType(myContractReference.ReadDocument(wsdlStream), _
             ServiceDescription)
         Console.Write(("Target Namesapce for the service description is: " _
             + myServiceDescription.TargetNamespace))
         wsdlStream.Close()

      Catch e As Exception
         Console.WriteLine(("Exception: " + e.Message))
      End Try
   End Sub
End Class

적용 대상

추가 정보