SoapBinding 类
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
表示发现文档中的 SOAP 绑定。 此类不能被继承。
public ref class SoapBinding sealed
public sealed class SoapBinding
type SoapBinding = class
Public NotInheritable Class SoapBinding
- 继承
-
SoapBinding
#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 );
}
}
using System;
using System.Net;
using System.Security.Permissions;
using System.Xml;
using System.Web.Services.Discovery;
class DiscoverySoapBindingClass
{
static void Main()
{
Run();
}
[PermissionSetAttribute(SecurityAction.Demand, Name="FullTrust")]
static void Run()
{
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 =
new DiscoveryClientProtocol();
myDiscoveryClientProtocol.Credentials =
CredentialCache.DefaultCredentials;
DiscoveryDocument myDiscoveryDocument =
myDiscoveryClientProtocol.Discover(myStringUrl);
Console.WriteLine("Demonstrating the Discovery.SoapBinding class.");
// Create a SOAP binding.
SoapBinding mySoapBinding = new 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 = new 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: "
+ SoapBinding.Namespace);
// Write all the information of the DiscoveryClientProtocol.
myDiscoveryClientProtocol.WriteAll(".","results.discomap");
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
}
}
Imports System.Net
Imports System.Security.Permissions
Imports System.Xml
Imports System.Web.Services.Discovery
Class DiscoverySoapBindingMod
Shared Sub Main()
Run()
End Sub
<PermissionSetAttribute(SecurityAction.Demand, Name := "FullTrust")> _
Shared Sub Run()
Try
' 'dataservice.disco' is a sample discovery document.
Dim myStringUrl As String = "http://localhost/dataservice.disco"
' Call the Discover method to populate the Documents property.
Dim myDiscoveryClientProtocol As DiscoveryClientProtocol = _
New DiscoveryClientProtocol()
myDiscoveryClientProtocol.Credentials = _
CredentialCache.DefaultCredentials
Dim myDiscoveryDocument As DiscoveryDocument = _
myDiscoveryClientProtocol.Discover(myStringUrl)
Console.WriteLine("Demonstrating the Discovery.SoapBinding class.")
' Create a SOAP binding.
Dim mySoapBinding As SoapBinding = New SoapBinding()
' Assign the address to the SOAP binding.
mySoapBinding.Address = "http://schemas.xmlsoap.org/disco/scl/"
' Bind the created SOAP binding with a new XmlQualifiedName.
mySoapBinding.Binding = New 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 the SOAP binding.
Console.WriteLine("Namespace associated with Soap Binding is: " _
+ SoapBinding.Namespace)
' Write all the information of the DiscoveryClientProtocol.
myDiscoveryClientProtocol.WriteAll(".","results.discomap")
Catch e As Exception
Console.WriteLine(e.ToString)
End Try
End Sub
End Class
SOAP 绑定类似于 XML Web 服务的接口。 它对于版本控制以及查找实现特定 SOAP 绑定的 XML Web 服务非常有用。 例如,发现文档可能包含有关 SOAP 绑定的可选信息,这些信息指定由引用的 Web 服务实现的 SOAP 绑定。 通过添加 SOAP
XML 命名空间等于 Namespace 常量的 XML 元素,在发现文档中包含的 XML 文档中指定 SOAP 绑定。 属性 Address 指定 XML Web 服务的 URL, Binding 属性指定由该 XML Web 服务实现的 SOAP 绑定。
Soap |
初始化 SoapBinding 类的新实例。 |
Namespace |
指定发现文档中的 SOAP 绑定的元素的 XML 命名空间。 |
Address |
获取或设置实现 SOAP 绑定的 XML Web services 的 URL。 |
Binding |
获取或设置由 XML Web services 实现的 SOAP 绑定的 XML 限定名。 |
Equals(Object) |
确定指定对象是否等于当前对象。 (继承自 Object) |
Get |
作为默认哈希函数。 (继承自 Object) |
Get |
获取当前实例的 Type。 (继承自 Object) |
Memberwise |
创建当前 Object 的浅表副本。 (继承自 Object) |
To |
返回表示当前对象的字符串。 (继承自 Object) |
产品 | 版本 |
---|---|
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |