Partager via


Port Classe

Définition

Définit un point de terminaison individuel contenu dans le service Web XML. Cette classe ne peut pas être héritée.

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
Héritage
Héritage
Attributs

Exemples

Les exemples suivants créent un Port élément et l’ajoutent à la Ports collection d’un nom myDescriptionexistantServiceDescription.

// 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)

Remarques

Cette classe spécifie une seule adresse (URI) pour un Binding, qui définit le format de message et les détails du protocole pour les opérations et les messages pour un donné PortType. La Binding propriété obtient ou définit ces valeurs pour un élément spécifié Port.

Cette classe correspond à l’élément WSDL (Web Services Description Language), <port> qui est entouré de l’élément <service> . Pour plus d’informations sur WSDL, consultez la spécification WSDL .

Constructeurs

Nom Description
Port()

Initialise une nouvelle instance de la classe Port.

Propriétés

Nom Description
Binding

Obtient ou définit la valeur de l’attribut XML <binding> du Port.

Documentation

Obtient ou définit la documentation textuelle de l’instance du DocumentableItem.

(Hérité de DocumentableItem)
DocumentationElement

Obtient ou définit l’élément de documentation pour le DocumentableItem.

(Hérité de DocumentableItem)
ExtensibleAttributes

Obtient ou définit un tableau de type XmlAttribute qui représente les extensions d’attribut de WSDL pour se conformer à l’interopérabilité des services Web (WS-I) Profil de base 1.1.

(Hérité de DocumentableItem)
Extensions

Obtient la collection d’éléments d’extensibilité associés au Port.

Name

Obtient ou définit le nom du Port.

Name

Obtient ou définit le nom de l’élément.

(Hérité de NamedItem)
Namespaces

Obtient ou définit le dictionnaire des préfixes d’espace de noms et des espaces de noms utilisés pour conserver les préfixes et les espaces de noms d’espace de noms lorsqu’un ServiceDescription objet est construit.

(Hérité de DocumentableItem)
Service

Obtient celui dont le ServicePort membre est membre.

Méthodes

Nom Description
Equals(Object)

Détermine si l’objet spécifié est égal à l’objet actuel.

(Hérité de Object)
GetHashCode()

Sert de fonction de hachage par défaut.

(Hérité de Object)
GetType()

Obtient la Type de l’instance actuelle.

(Hérité de Object)
MemberwiseClone()

Crée une copie superficielle du Objectactuel.

(Hérité de Object)
ToString()

Retourne une chaîne qui représente l’objet actuel.

(Hérité de Object)

S’applique à

Voir aussi