Бөлісу құралы:


Port Класс

Определение

Определяет отдельную конечную точку, содержащуюся в веб-службе XML. Этот класс не может быть унаследован.

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 именованного 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) для определенного BindingPortTypeобъекта, который определяет формат сообщения и сведения о протоколе для операций и сообщений. Свойство Binding получает или задает эти значения для указанного Port.

Этот класс соответствует элементу языка описания веб-служб (WSDL), <port> который заключен в <service> элемент. Дополнительные сведения о WSDL см. в спецификации WSDL .

Конструкторы

Имя Описание
Port()

Инициализирует новый экземпляр класса Port.

Свойства

Имя Описание
Binding

Возвращает или задает значение XML-атрибута <binding> объекта Port.

Documentation

Возвращает или задает текстовую документацию для экземпляра DocumentableItemобъекта .

(Унаследовано от DocumentableItem)
DocumentationElement

Возвращает или задает элемент документации для элемента DocumentableItem.

(Унаследовано от DocumentableItem)
ExtensibleAttributes

Возвращает или задает массив типа XmlAttribute , представляющий расширения атрибутов WSDL для соответствия требованиям взаимодействия веб-служб (WS-I) базовый профиль 1.1.

(Унаследовано от DocumentableItem)
Extensions

Возвращает коллекцию элементов расширяемости, связанных с Port.

Name

Возвращает или задает имя Portобъекта .

Name

Возвращает или задает имя элемента.

(Унаследовано от NamedItem)
Namespaces

Возвращает или задает словарь префиксов пространства имен и пространств имен, используемых для сохранения префиксов пространства имен и пространств имен при ServiceDescription создании объекта.

(Унаследовано от DocumentableItem)
Service

Возвращает значение Service , из которого Port входит элемент.

Методы

Имя Описание
Equals(Object)

Определяет, равен ли указанный объект текущему объекту.

(Унаследовано от Object)
GetHashCode()

Служит хэш-функцией по умолчанию.

(Унаследовано от Object)
GetType()

Возвращает Type текущего экземпляра.

(Унаследовано от Object)
MemberwiseClone()

Создает неглубокую копию текущей Object.

(Унаследовано от Object)
ToString()

Возвращает строку, представляющую текущий объект.

(Унаследовано от Object)

Применяется к

См. также раздел