Port 类

定义

定义包含在 XML Web services 中的单个终结点。Defines an individual endpoint contained in the XML Web service. 此类不能被继承。This class cannot be inherited.

public ref class Port sealed : System::Web::Services::Description::DocumentableItem
public ref class Port sealed : System::Web::Services::Description::NamedItem
[System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")]
public sealed class Port : System.Web.Services.Description.DocumentableItem
[System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")]
public sealed class Port : System.Web.Services.Description.NamedItem
[<System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")>]
type Port = class
    inherit DocumentableItem
[<System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")>]
type Port = class
    inherit NamedItem
Public NotInheritable Class Port
Inherits DocumentableItem
Public NotInheritable Class Port
Inherits NamedItem
继承
继承
属性

示例

下面的示例创建一个 Port ,并将其添加到 Ports 现有的已命名的集合中 ServiceDescription myDescriptionThe following examples creates a Port and adds it to the Ports collection of an existing ServiceDescription named myDescription.

// Create a Port.
Port^ postPort = gcnew Port;
postPort->Name = "PortServiceHttpPost";
postPort->Binding = gcnew XmlQualifiedName( "s0:PortServiceHttpPost" );

// Create an HttpAddressBinding.
HttpAddressBinding^ postAddressBinding = gcnew HttpAddressBinding;
postAddressBinding->Location = "http://localhost/PortClass/PortService_cs.asmx";

// Add the HttpAddressBinding to the Port.
postPort->Extensions->Add( postAddressBinding );

// Get the Service of the postPort.
Service^ myService = postPort->Service;

// Print the service name for the port.
Console::WriteLine( "This is the service name of the postPort:*{0}*", myDescription->Services[ 0 ]->Ports[ 0 ]->Service->Name );

// Add the Port to the PortCollection of the ServiceDescription.
myDescription->Services[ 0 ]->Ports->Add( postPort );
// Create a Port.
Port postPort = new Port();
postPort.Name = "PortServiceHttpPost";
postPort.Binding = new XmlQualifiedName("s0:PortServiceHttpPost");

// Create an HttpAddressBinding.
HttpAddressBinding postAddressBinding = new HttpAddressBinding();
postAddressBinding.Location =
   "http://localhost/PortClass/PortService_cs.asmx";

// Add the HttpAddressBinding to the Port.
postPort.Extensions.Add(postAddressBinding);

// Get the Service of the postPort.
Service myService = postPort.Service;

// Print the service name for the port.
Console.WriteLine("This is the service name of the postPort:*" +
   myDescription.Services[0].Ports[0].Service.Name + "*");

// Add the Port to the PortCollection of the ServiceDescription.
myDescription.Services[0].Ports.Add(postPort);

' Create a Port.
Dim postPort As New Port()
postPort.Name = "PortServiceHttpPost"
postPort.Binding = New XmlQualifiedName("s0:PortServiceHttpPost")


' Create an HttpAddressBinding.
Dim postAddressBinding As New HttpAddressBinding()
postAddressBinding.Location = _
   "http://localhost/PortClass/PortService.vb.asmx"

' Add the HttpAddressBinding to the Port.
postPort.Extensions.Add(postAddressBinding)

' Get the Service of the postPort.
Dim myService As Service = postPort.Service

' Print the service name for the port.
Console.WriteLine("This is the service name of the postPort:*" & _
   myDescription.Services(0).Ports(0).Service.Name & "*")

' Add the Port to the PortCollection of the ServiceDescription.
myDescription.Services(0).Ports.Add(postPort)

注解

此类为指定单个地址 (URI) Binding ,该地址定义给定的操作和消息的消息格式和协议详细信息 PortTypeThis class specifies a single address (URI) for a Binding, which defines message format and protocol details for operations and messages for a given PortType. Binding属性获取或设置指定的的值 PortThe Binding property gets or sets those values for a specified Port.

此类对应于 Web 服务描述语言 (WSDL) <port> 元素,它由元素括起来 <service>This class corresponds to the Web Services Description Language (WSDL) <port> element, which is enclosed by the <service> element. 有关 WSDL 的更多信息,请参阅 WSDL 规范。For more information about WSDL, see the WSDL specification.

构造函数

Port()

初始化 Port 类的新实例。Initializes a new instance of the Port class.

属性

Binding

获取或设置 Port 的 XML <binding> 特性的值。Gets or sets the value of the XML <binding> attribute of the Port.

Documentation

获取或设置 DocumentableItem 的实例的文本文档。Gets or sets the text documentation for the instance of the DocumentableItem.

(继承自 DocumentableItem)
DocumentationElement

获取或设置 DocumentableItem 的文档元素。Gets or sets the documentation element for the DocumentableItem.

(继承自 DocumentableItem)
ExtensibleAttributes

获取或设置类型为 XmlAttribute 的数组,该数组表示为符合 Web 服务互操作性 (WS-I) 基本概要 1.1 而进行的 WSDL 特性扩展。Gets or sets an array of type XmlAttribute that represents attribute extensions of WSDL to comply with Web Services Interoperability (WS-I) Basic Profile 1.1.

(继承自 DocumentableItem)
Extensions

获取与 Port 关联的扩展性元素的集合。Gets the collection of extensibility elements associated with the Port.

Name

获取或设置 Port 的名称。Gets or sets the name of the Port.

Name

获取或设置项的名称。Gets or sets the name of the item.

(继承自 NamedItem)
Namespaces

获取或设置命名空间前缀和命名空间的字典,该字典用于在构造 ServiceDescription 对象时,保留命名空间的前缀和命名空间。Gets or sets the dictionary of namespace prefixes and namespaces used to preserve namespace prefixes and namespaces when a ServiceDescription object is constructed.

(继承自 DocumentableItem)
Service

获取 Service 为其成员的 PortGets the Service of which the Port is a member.

方法

Equals(Object)

确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)

适用于

另请参阅