ContractReference::ReadDocument Method (Stream^)

 

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

.NET Framework
Available since 1.1
Return to top
Show: