Språk

Port Klass

Definition

Definierar en enskild slutpunkt som finns i XML-webbtjänsten. Det går inte att ärva den här klassen.

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
Arv
Arv
Attribut

Exempel

Följande exempel skapar en Port och lägger till den i Ports samlingen av en befintlig ServiceDescription med namnet 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)

Kommentarer

Den här klassen anger en enskild adress (URI) för en Binding, som definierar meddelandeformat och protokollinformation för åtgärder och meddelanden för en viss PortType. Egenskapen Binding hämtar eller anger dessa värden för en angiven Port.

Den här klassen motsvarar WSDL-elementet (Web Services Description Language), <port> som omges av elementet <service> . Mer information om WSDL finns i WSDL-specifikationen .

Konstruktorer

Name Description
Port()

Initierar en ny instans av Port klassen.

Egenskaper

Name Description
Binding

Hämtar eller anger värdet för XML-attributet <binding> för Port.

Documentation

Hämtar eller anger textdokumentationen för instansen DocumentableItemav .

(Ärvd från DocumentableItem)
DocumentationElement

Hämtar eller anger dokumentationselementet DocumentableItemför .

(Ärvd från DocumentableItem)
ExtensibleAttributes

Hämtar eller anger en matris av typen XmlAttribute som representerar attributtillägg för WSDL för att följa Web Services Interoperability (WS-I) Basic Profile 1.1.

(Ärvd från DocumentableItem)
Extensions

Hämtar samlingen med utökningsbarhetselement som är associerade med Port.

Name

Hämtar eller anger namnet på Port.

Name

Hämtar eller anger namnet på objektet.

(Ärvd från NamedItem)
Namespaces

Hämtar eller anger ordlistan med namnområdesprefix och namnområden som används för att bevara namnområdesprefix och namnområden när ett ServiceDescription objekt skapas.

(Ärvd från DocumentableItem)
Service

Hämtar som Service är medlem i Port .

Metoder

Name Description
Equals(Object)

Avgör om det angivna objektet är lika med det aktuella objektet.

(Ärvd från Object)
GetHashCode()

Fungerar som standard-hash-funktion.

(Ärvd från Object)
GetType()

Hämtar den aktuella instansen Type .

(Ärvd från Object)
MemberwiseClone()

Skapar en ytlig kopia av den aktuella Object.

(Ärvd från Object)
ToString()

Returnerar en sträng som representerar det aktuella objektet.

(Ärvd från Object)

Gäller för

Se även