/// <summary> /// Create a node endpoint client factory instance that can be used to create node client endpoint accessors. Use this /// method instead of CreateClientFactory() if you want to call INodeEndpointClientFactory.Make() without having to pass /// in the NAAS authentication credentials each time. /// </summary> /// <param name="defaultCredentials">The NAAS default authentication credentials to assign (unless specified otherwise) to /// the node client endpoint accessors returned from INodeEndpointClientFactory.Make().</param> /// <returns>The <see cref="INodeEndpointClientFactory"/> instance that can be used to create <see cref="INodeEndpointClient"/> node client /// endpoint accessors.</returns> public static INodeEndpointClientFactory CreateClientFactory(AuthenticationCredentials defaultCredentials) { NodeEndpointClientFactory factory = new NodeEndpointClientFactory(); factory.DefaultAuthenticationCredentials = defaultCredentials; factory.Init(); return(factory); }
/// <summary> /// Create a node endpoint client factory instance that can be used to create node client endpoint accessors. Use this /// method instead of CreateClientFactory() if you want to call INodeEndpointClientFactory.Make() without having to pass /// in the NAAS authentication credentials each time. /// </summary> /// <param name="defaultUsername">The NAAS default authentication username to assign (unless specified otherwise) to /// the node client endpoint accessors returned from INodeEndpointClientFactory.Make().</param> /// <param name="defaultPassword">The NAAS default authentication password to assign (unless specified otherwise) to /// the node client endpoint accessors returned from INodeEndpointClientFactory.Make().</param> /// <returns>The <see cref="INodeEndpointClientFactory"/> instance that can be used to create <see cref="INodeEndpointClient"/> node client /// endpoint accessors.</returns> public static INodeEndpointClientFactory CreateClientFactory(string defaultUsername, string defaultPassword) { NodeEndpointClientFactory factory = new NodeEndpointClientFactory(); factory.DefaultAuthenticationCredentials = new AuthenticationCredentials(defaultUsername, defaultPassword); factory.Init(); return(factory); }
/// <summary> /// Create a new <see cref="INodeEndpointClient"/> instance for accessing and communicating with a specific Exchange node. /// The input credentials are authenticated against the client node before this method returns. /// </summary> /// <param name="targetEndpointUrl">The url for the Exchange node endpoint.</param> /// <param name="type">The version of the Exchange node endpoint.</param> /// <param name="credentials">The credentials used to authenticate with the Exchange node endpoint.</param> /// <param name="tempDirectoryPath">A local directory path used for creating temporary files during INodeEndpointClient method /// execution. This value can be null, in which case the dafault system temp directory will be used.</param> /// <param name="proxy">Proxy information for accessing the Exchange node endpoint. This value can be null if /// no proxy is required.</param> /// <returns>A new <see cref="INodeEndpointClient"/> instance for accessing and communicating with a specific Exchange node. Dispose() /// should be called on the returned instance when the caller is finished using the instance.</returns> public static INodeEndpointClient CreateClientAndAuthenticate(string targetEndpointUrl, EndpointVersionType type, AuthenticationCredentials credentials, string tempDirectoryPath, IWebProxy proxy) { INodeEndpointClient client = new NodeEndpointClientFactory().Make(targetEndpointUrl, type, credentials, tempDirectoryPath, proxy); try { client.Authenticate(); } catch (Exception) { DisposableBase.SafeDispose(client); throw; } return(client); }
/// <summary> /// Create a new <see cref="INodeEndpointClient"/> instance for accessing and communicating with a specific Exchange node. /// The node is pinged after is it created to ensure it can be accessed. /// </summary> /// <param name="targetEndpointUrl">The url for the Exchange node endpoint.</param> /// <param name="type">The version of the Exchange node endpoint.</param> /// <param name="naasUserToken">A valid NAAS user token that will be used for validating this endpoint.</param> /// <param name="tempDirectoryPath">A local directory path used for creating temporary files during INodeEndpointClient method /// execution. This value can be null, in which case the dafault system temp directory will be used.</param> /// <param name="proxy">Proxy information for accessing the Exchange node endpoint. This value can be null if /// no proxy is required.</param> /// <returns>A new <see cref="INodeEndpointClient"/> instance for accessing and communicating with a specific Exchange node. Dispose() /// should be called on the returned instance when the caller is finished using the instance.</returns> public static INodeEndpointClient CreateClientAndPing(string targetEndpointUrl, EndpointVersionType type, string naasUserToken, string tempDirectoryPath, IWebProxy proxy) { INodeEndpointClient client = new NodeEndpointClientFactory().Make(targetEndpointUrl, type, naasUserToken, tempDirectoryPath, proxy); try { client.NodePing(); } catch (Exception) { DisposableBase.SafeDispose(client); throw; } return(client); }
public static Exception PingNode(string targetEndpointUrl, EndpointVersionType type) { try { using (INodeEndpointClient client = new NodeEndpointClientFactory().Make(targetEndpointUrl, type, new AuthenticationCredentials("test", "test"), null, null)) { client.Timeout = 8000; client.NodePing(); } return(null); } catch (Exception e) { return(e); } }
/// <summary> /// Create a node endpoint client factory instance that can be used to create node client endpoint accessors. /// </summary> /// <returns>The <see cref="INodeEndpointClientFactory"/> instance that can be used to create <see cref="INodeEndpointClient"/> /// node client endpoint accessors.</returns> public static INodeEndpointClientFactory CreateClientFactory() { NodeEndpointClientFactory factory = new NodeEndpointClientFactory(); return(factory); }