UA Bundle SDK .NET  2.2.1.258
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Groups Pages
Discovery – Get Endpoints

Description

The following dialog shows an example implementation of the method Get Endpoints. It can be used to fetch all endpoints supported by the server. Press the button “Show Code” to display the corresponding code, and the button “Help” to show this documentation page.

Enter the endpoint URL into the input field at “Server URL” an press the button “Get Endpoints”. Then all discovered endpoints will be listed in the table at “Get Endpoints Response”. Check the box in front of “Use Asynchronous Pattern” to call “BeginGetEndpoints” instead of “GetEndpoints”.

Sample Code

The following code fetches all supported endpoints of a given server and displays the response in a list.

try
{
// create the object used to find servers or endpoints.
Discovery discovery = new Discovery();
// validate the URL.
if (!Uri.IsWellFormedUriString(ServerUrlTB.Text, UriKind.Absolute))
{
throw new ArgumentException("The URL is not valid", "ServerUrl");
}
// clear the existing servers.
EndpointsLV.Items.Clear();
// this is a blocking call so show the wait cursor.
Cursor = Cursors.WaitCursor;
// look for the LDS with the default endpoint.
List<EndpointDescription> endpoints = discovery.GetEndpoints(ServerUrlTB.Text);
// update list view.
foreach (EndpointDescription endpoint in endpoints)
{
ListViewItem item = new ListViewItem();
item.Text = endpoint.EndpointUrl;
item.SubItems.Add(endpoint.SecurityMode.ToString());
item.SubItems.Add(SecurityProfiles.GetDisplayName(endpoint.SecurityPolicyUri));
item.Tag = endpoint;
EndpointsLV.Items.Add(item);
}
// adjust the column widths.
foreach (ColumnHeader column in EndpointsLV.Columns)
{
column.Width = -2;
}
}
catch (Exception exception)
{
ExceptionDlg.Show(this.Text, exception);
}