Port-Klasse
Definiert einen einzelnen, im XML-Webdienst enthaltenen Endpunkt. Diese Klasse kann nicht geerbt werden.
Namespace: System.Web.Services.Description
Assembly: System.Web.Services (in system.web.services.dll)
Syntax
'Declaration
Public NotInheritable Class Port
Inherits NamedItem
'Usage
Dim instance As Port
public sealed class Port : NamedItem
public ref class Port sealed : public NamedItem
public final class Port extends NamedItem
public final class Port extends NamedItem
Hinweise
Diese Klasse gibt eine einzelne Adresse (URI) für ein Binding an, die Einzelheiten des Meldungsformats und Protokolls für Operationen und Meldungen eines angegebenen PortType definiert. Die Binding-Eigenschaft ruft diese Werte für einen angegebenen Port ab oder legt diese fest.
Diese Klasse entspricht dem WSDL-<port>-Element (Web Services Description Language), das vom <service>-Element eingeschlossen wird. Weitere Informationen über WSDL finden Sie in der Spezifikation unter "http://www.w3.org/TR/wsdl".
Beispiel
' 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 = _
"https://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)
// 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 =
"https://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.
Port^ postPort = gcnew Port;
postPort->Name = "PortServiceHttpPost";
postPort->Binding = gcnew XmlQualifiedName( "s0:PortServiceHttpPost" );
// Create an HttpAddressBinding.
HttpAddressBinding^ postAddressBinding = gcnew HttpAddressBinding;
postAddressBinding->Location = "https://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.set_Name("PortServiceHttpPost");
postPort.set_Binding(
new XmlQualifiedName("s0:PortServiceHttpPost"));
// Create an HttpAddressBinding.
HttpAddressBinding postAddressBinding = new HttpAddressBinding();
postAddressBinding.set_Location(
"https://localhost/PortClass/PortService_jsl.asmx");
// Add the HttpAddressBinding to the Port.
postPort.get_Extensions().Add(postAddressBinding);
// Get the Service of the postPort.
Service myService = postPort.get_Service();
// Print the service name for the port.
Console.WriteLine("This is the service name of the postPort:*"
+ myDescription.get_Services().get_Item(0).get_Ports().
get_Item(0).get_Service().get_Name() + "*");
// Add the Port to the PortCollection of the ServiceDescription.
myDescription.get_Services().get_Item(0).get_Ports().Add(postPort);
Vererbungshierarchie
System.Object
System.Web.Services.Description.DocumentableItem
System.Web.Services.Description.NamedItem
System.Web.Services.Description.Port
Threadsicherheit
Alle öffentlichen statischen (Shared in Visual Basic) Member dieses Typs sind threadsicher. Bei Instanzmembern ist die Threadsicherheit nicht gewährleistet.
Plattformen
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
Siehe auch
Referenz
Port-Member
System.Web.Services.Description-Namespace
Service