/// <summary> /// Tests a call to User Details Service /// </summary> static void TestUserDetailsService() { Console.WriteLine("TestUserDetailsService"); System.ServiceModel.Channels.Binding binding = FaBindingFactory.GetUsernameTokenOverSslBinding(); EndpointAddress endpointAddress = new EndpointAddress(new Uri("Url to the service")); UserDetailsServiceClient client = FaServiceFactory.GetUserDetailsServiceClient(binding, endpointAddress, new NetworkCredential(userName, password)); UserDetailsResult result = client.findSelfUserDetails(); if (null != result) { UserDetails[] userDetails = result.Value; if (null != userDetails) { foreach (UserDetails userDetail in userDetails) { Console.WriteLine(" Person id = " + userDetail.PersonId); } } } else { Console.WriteLine(" result null "); } }
/// <summary> /// Static method to obtain instance of the UserDetailsService /// </summary> /// <param name="binding">The binding that defines the how the. Currently 2 pre-defined bindings are provided /// UsernameTokenOverSslBinding and UsernameTokenBinding. The binding used must match the OWSM policy defined on the service</param> /// <param name="endpointAddress">The URL of the endpoint that hosts the service</param> /// <param name="credentials">The credentials to be used to invoke the service</param> /// <returns>Instance of the UserDetailsService client</returns> public static UserDetailsServiceClient GetUserDetailsServiceClient(System.ServiceModel.Channels.Binding binding, EndpointAddress endpointAddress, NetworkCredential credentials) { UserDetailsServiceClient client = new UserDetailsServiceClient(binding, endpointAddress); client.ClientCredentials.UserName.UserName = credentials.UserName; client.ClientCredentials.UserName.Password = credentials.Password; client.Endpoint.Behaviors.Add(new EmptyElementBehavior()); return(client); }
/// <summary> /// Static method to obtain instance of the UserDetailsService /// </summary> /// <param name="binding">The binding that defines the how the. Currently 2 pre-defined bindings are provided /// UsernameTokenOverSslBinding and UsernameTokenBinding. The binding used must match the OWSM policy defined on the service</param> /// <param name="endpointAddress">The URL of the endpoint that hosts the service</param> /// <param name="credentials">The credentials to be used to invoke the service</param> /// <returns>Instance of the UserDetailsService client</returns> public static UserDetailsServiceClient GetUserDetailsServiceClient(System.ServiceModel.Channels.Binding binding, EndpointAddress endpointAddress, NetworkCredential credentials) { UserDetailsServiceClient client = new UserDetailsServiceClient(binding, endpointAddress); client.ClientCredentials.UserName.UserName = credentials.UserName; client.ClientCredentials.UserName.Password = credentials.Password; client.Endpoint.Behaviors.Add(new EmptyElementBehavior()); return client; }