This documentation is archived and is not being maintained.

ContractReference::ReadDocument Method

Reads the service description from the passed Stream and returns the service description.

Namespace:  System.Web.Services.Discovery
Assembly:  System.Web.Services (in System.Web.Services.dll)

public:
virtual Object^ ReadDocument(
	Stream^ stream
) override

Parameters

stream
Type: System.IO::Stream

Stream containing the service description.

Return Value

Type: System::Object
A ServiceDescription containing the contents of the referenced service description.

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 );
   }
}
int main() {
   try {
      // Create the file stream.
      FileStream* wsdlStream = new FileStream(S"MyService1_cs.wsdl",
         FileMode::Open);
      ContractReference* myContractReference = new ContractReference();

      // Read the service description from the passed stream.
      ServiceDescription* myServiceDescription=
         dynamic_cast<ServiceDescription*>(myContractReference->ReadDocument(wsdlStream));
      Console::Write(S"Target Namespace for the service description is: {0}",
         myServiceDescription->TargetNamespace);
      wsdlStream->Close();
   } catch (Exception* e) {
      Console::WriteLine(S"Exception: {0}", e->Message);
   }
}

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0
Show: