Edit

Bagikan melalui


EndpointAddress Constructors

Definition

Initializes a new instance of the EndpointAddress class.

Overloads

EndpointAddress(String)

Initializes a new instance of the EndpointAddress class with a specified URI string.

EndpointAddress(Uri, AddressHeader[])

Initializes a new instance of the EndpointAddress class with a specified URI and headers.

EndpointAddress(Uri, EndpointIdentity, AddressHeader[])

Initializes a new instance of the EndpointAddress class with a specified URI, identity, and headers.

EndpointAddress(Uri, EndpointIdentity, AddressHeaderCollection)

Initializes a new instance of the EndpointAddress class with a specified URI, identity, and header collection.

EndpointAddress(Uri, EndpointIdentity, AddressHeaderCollection, XmlDictionaryReader, XmlDictionaryReader)

Initializes a new instance of the EndpointAddress class with a specified URI, identity, header collection, and metadata and extension readers.

EndpointAddress(String)

Source:
EndpointAddress.cs

Initializes a new instance of the EndpointAddress class with a specified URI string.

public:
 EndpointAddress(System::String ^ uri);
public EndpointAddress (string uri);
new System.ServiceModel.EndpointAddress : string -> System.ServiceModel.EndpointAddress
Public Sub New (uri As String)

Parameters

uri
String

The URI that identifies the endpoint.

Examples

AddressHeader addressHeader1 = AddressHeader.CreateAddressHeader("specialservice1", "http://localhost:8000/service", 1);
AddressHeader addressHeader2 = AddressHeader.CreateAddressHeader("specialservice2", "http://localhost:8000/service", 2);

AddressHeader[] addressHeaders = new AddressHeader[2] { addressHeader1, addressHeader2 };
AddressHeaderCollection headers = new AddressHeaderCollection(addressHeaders);

EndpointIdentity endpointIdentity =
    EndpointIdentity.CreateUpnIdentity(WindowsIdentity.GetCurrent().Name);
EndpointAddress endpointAddress = new EndpointAddress(
    new Uri
    ("http://localhost:8003/servicemodelsamples/service/incode/identity"),
    endpointIdentity, addressHeaders);

Uri anonUri = EndpointAddress.AnonymousUri;

Applies to

EndpointAddress(Uri, AddressHeader[])

Source:
EndpointAddress.cs

Initializes a new instance of the EndpointAddress class with a specified URI and headers.

public:
 EndpointAddress(Uri ^ uri, ... cli::array <System::ServiceModel::Channels::AddressHeader ^> ^ addressHeaders);
public EndpointAddress (Uri uri, params System.ServiceModel.Channels.AddressHeader[] addressHeaders);
new System.ServiceModel.EndpointAddress : Uri * System.ServiceModel.Channels.AddressHeader[] -> System.ServiceModel.EndpointAddress
Public Sub New (uri As Uri, ParamArray addressHeaders As AddressHeader())

Parameters

uri
Uri

The Uri that identifies the endpoint location.

addressHeaders
AddressHeader[]

The Array of type AddressHeader that contains address information used to interact with the endpoint.

Examples

The following code shows the use of this constructor.

Applies to

EndpointAddress(Uri, EndpointIdentity, AddressHeader[])

Source:
EndpointAddress.cs

Initializes a new instance of the EndpointAddress class with a specified URI, identity, and headers.

public:
 EndpointAddress(Uri ^ uri, System::ServiceModel::EndpointIdentity ^ identity, ... cli::array <System::ServiceModel::Channels::AddressHeader ^> ^ addressHeaders);
public EndpointAddress (Uri uri, System.ServiceModel.EndpointIdentity identity, params System.ServiceModel.Channels.AddressHeader[] addressHeaders);
new System.ServiceModel.EndpointAddress : Uri * System.ServiceModel.EndpointIdentity * System.ServiceModel.Channels.AddressHeader[] -> System.ServiceModel.EndpointAddress
Public Sub New (uri As Uri, identity As EndpointIdentity, ParamArray addressHeaders As AddressHeader())

Parameters

uri
Uri

The Uri that identifies the endpoint location.

identity
EndpointIdentity

The EndpointIdentity for the endpoint.

addressHeaders
AddressHeader[]

The Array of type AddressHeader that contains address information used to interact with the endpoint.

Examples

The following code shows how to construct an EndpointAddress object with a Uri, EndpointIdentity and an array of AddressHeader objects.

        //Create new address headers for special services and add them to an array
        AddressHeader addressHeader1 = AddressHeader.CreateAddressHeader("specialservice1", "http://localhost:8000/service", 1);
        AddressHeader addressHeader2 = AddressHeader.CreateAddressHeader("specialservice2", "http://localhost:8000/service", 2);

        AddressHeader[] addressHeaders = new AddressHeader[2] { addressHeader1, addressHeader2 };

        EndpointIdentity endpointIdentity = EndpointIdentity.CreateUpnIdentity(WindowsIdentity.GetCurrent().Name);

        EndpointAddress endpointAddress = new EndpointAddress(
            new Uri
        ("http://localhost:8003/servicemodelsamples/service/incode/identity"),
        endpointIdentity, addressHeaders);

Applies to

EndpointAddress(Uri, EndpointIdentity, AddressHeaderCollection)

Initializes a new instance of the EndpointAddress class with a specified URI, identity, and header collection.

public:
 EndpointAddress(Uri ^ uri, System::ServiceModel::EndpointIdentity ^ identity, System::ServiceModel::Channels::AddressHeaderCollection ^ headers);
public EndpointAddress (Uri uri, System.ServiceModel.EndpointIdentity identity, System.ServiceModel.Channels.AddressHeaderCollection headers);
new System.ServiceModel.EndpointAddress : Uri * System.ServiceModel.EndpointIdentity * System.ServiceModel.Channels.AddressHeaderCollection -> System.ServiceModel.EndpointAddress
Public Sub New (uri As Uri, identity As EndpointIdentity, headers As AddressHeaderCollection)

Parameters

uri
Uri

The Uri that identifies the endpoint location.

identity
EndpointIdentity

The EndpointIdentity for the endpoint.

headers
AddressHeaderCollection

The AddressHeaderCollection that contains address information used to interact with the endpoint.

Examples

The following code shows how to construct a EndpointAddress object with a Uri, EndpointIdentity and an AddressHeaderCollection object.

        //Create new address headers for special services and add them to an array
        AddressHeader addressHeader1 = AddressHeader.CreateAddressHeader("specialservice1", "http://localhost:8000/service", 1);
        AddressHeader addressHeader2 = AddressHeader.CreateAddressHeader("specialservice2", "http://localhost:8000/service", 2);

        AddressHeader[] addressHeaders = new AddressHeader[2] { addressHeader1, addressHeader2 };
        AddressHeaderCollection addressHeaderColl = new AddressHeaderCollection(addressHeaders);

    // <Snippet#15>
        EndpointIdentity endpointIdentity = EndpointIdentity.CreateUpnIdentity(WindowsIdentity.GetCurrent().Name);
        EndpointAddress endpointAddress = new EndpointAddress(
            new Uri("http://localhost:8003/servicemodelsamples/service/incode/identity"),
        endpointIdentity,
        addressHeaderColl);
    EndpointIdentity thisEndpointIdentity = endpointAddress.Identity;
    // </Snippet#15>

Applies to

EndpointAddress(Uri, EndpointIdentity, AddressHeaderCollection, XmlDictionaryReader, XmlDictionaryReader)

Initializes a new instance of the EndpointAddress class with a specified URI, identity, header collection, and metadata and extension readers.

public:
 EndpointAddress(Uri ^ uri, System::ServiceModel::EndpointIdentity ^ identity, System::ServiceModel::Channels::AddressHeaderCollection ^ headers, System::Xml::XmlDictionaryReader ^ metadataReader, System::Xml::XmlDictionaryReader ^ extensionReader);
public EndpointAddress (Uri uri, System.ServiceModel.EndpointIdentity identity, System.ServiceModel.Channels.AddressHeaderCollection headers, System.Xml.XmlDictionaryReader metadataReader, System.Xml.XmlDictionaryReader extensionReader);
new System.ServiceModel.EndpointAddress : Uri * System.ServiceModel.EndpointIdentity * System.ServiceModel.Channels.AddressHeaderCollection * System.Xml.XmlDictionaryReader * System.Xml.XmlDictionaryReader -> System.ServiceModel.EndpointAddress
Public Sub New (uri As Uri, identity As EndpointIdentity, headers As AddressHeaderCollection, metadataReader As XmlDictionaryReader, extensionReader As XmlDictionaryReader)

Parameters

uri
Uri

The Uri that identifies the endpoint location.

identity
EndpointIdentity

The EndpointIdentity for the endpoint.

headers
AddressHeaderCollection

The AddressHeaderCollection that contains address information used to interact with the endpoint.

metadataReader
XmlDictionaryReader

The XmlDictionaryReader from which the endpoint metadata is obtained.

extensionReader
XmlDictionaryReader

The XmlDictionaryReader from which extensions are obtained.

Examples

The following code shows how to instantiate a EndpointAddress that specifies a Uri, an EndpointIdentity, a headers collection, a metadata XmlDictionaryReader and an extension XmlDictionaryReader.

XmlDictionaryReader metadataReader = endpointAddress.GetReaderAtMetadata();
XmlDictionaryReader extensionReader = endpointAddress.GetReaderAtExtensions();
EndpointIdentity identity = EndpointIdentity.CreateUpnIdentity(WindowsIdentity.GetCurrent().Name);

EndpointAddress endpointAddress2 = new EndpointAddress(
    new Uri("http://localhost:8003/servicemodelsamples/service/incode/identity"), identity, headers, metadataReader, extensionReader);

Remarks

The WS-Addressing specification allows for arbitrary extension elements to appear at the end of an Endpoint Reference (EPR) that can be obtained using an XmlDictionaryReader.

Applies to