public static DashboardServiceClient GetService() { var _address = new EndpointAddress(serviceUrlPath); var _binding = new BasicHttpMessageInspectorBinding(new ServiceMessageInspector(), securityMode); var _service = new DashboardServiceClient(_binding, _address); return(_service); }
/// <summary> /// Instantiates an instance of the web service and configures the url /// and the credentials in the message header before returning the /// instance. /// </summary> /// <returns>An instance of the web service</returns> public static BackendDataServiceClient GetService() { BasicHttpSecurityMode securityMode = (IsSecure ? BasicHttpSecurityMode.Transport : BasicHttpSecurityMode.None); EndpointAddress address = new EndpointAddress(WebServiceUrlPath); BasicHttpMessageInspectorBinding binding = new BasicHttpMessageInspectorBinding(new HDServiceMessageInspector(), securityMode); BackendDataServiceClient service = new BackendDataServiceClient(binding, address); return(service); }
private void LoadMyProfile() { //Create the Message Inspector SPAsmxMessageInspector messageInspector = new SPAsmxMessageInspector(); //Apply the Message Inspector to the Binding BasicHttpMessageInspectorBinding binding = new BasicHttpMessageInspectorBinding(messageInspector); EndpointAddress endpoint = new EndpointAddress(Constants.USERPROFILE_SERVICE_URL); UserProfileSvc.UserProfileServiceSoapClient svc = new UserProfileServiceSoapClient(binding, endpoint); svc.CookieContainer = App.Cookies; svc.GetUserProfileByNameCompleted += new EventHandler <GetUserProfileByNameCompletedEventArgs>(svc_GetUserProfileByNameCompleted); svc.GetUserProfileByNameAsync(App.UserName); }