SoapBinding Class
Assembly: System.Web.Services (in system.web.services.dll)
A SOAP binding is similar to an interface for XML Web services. It is useful for versioning and when you look for a XML Web service implementing a specific SOAP binding. For instance, a discovery document might contain optional information about SOAP bindings, which specify the SOAP bindings implemented by referenced Web Servcies. SOAP bindings are specified within the XML document containd within a discovery document by adding a SOAP XML element with an XML namespace equal to the Namespace constant. The Address property specifies the URL of the XML Web service and the Binding property specifies the SOAP binding implemented by that XML Web service.
#using <System.dll> #using <System.Xml.dll> #using <System.Web.Services.dll> using namespace System; using namespace System::Net; using namespace System::Xml; using namespace System::Web::Services::Discovery; int main() { try { // 'dataservice.disco' is a sample discovery document. String^ myStringUrl = "http://localhost/dataservice.disco"; // Call the Discover method to populate the Documents property. DiscoveryClientProtocol^ myDiscoveryClientProtocol = gcnew DiscoveryClientProtocol; myDiscoveryClientProtocol->Credentials = CredentialCache::DefaultCredentials; DiscoveryDocument^ myDiscoveryDocument = myDiscoveryClientProtocol->Discover( myStringUrl ); Console::WriteLine( "Demonstrating the Discovery::SoapBinding class." ); // Create a SOAP binding. SoapBinding^ mySoapBinding = gcnew SoapBinding; // Assign an address to the created SOAP binding. mySoapBinding->Address = "http://schemas.xmlsoap.org/disco/scl/"; // Bind the created SOAP binding with a new XmlQualifiedName. mySoapBinding->Binding = gcnew XmlQualifiedName( "String*","http://www.w3.org/2001/XMLSchema" ); // Add the created SOAP binding to the DiscoveryClientProtocol. myDiscoveryClientProtocol->AdditionalInformation->Add( mySoapBinding ); // Display the namespace associated with SOAP binding. Console::WriteLine( "Namespace associated with the SOAP binding is: {0}", SoapBinding::Namespace ); // Write all the information of the DiscoveryClientProtocol. myDiscoveryClientProtocol->WriteAll( ".", "results.discomap" ); } catch ( Exception^ e ) { Console::WriteLine( e ); } }
Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.