Ejemplo n.º 1
0
        /// <summary>
        /// Static method to obtain instance of the ActivityService
        /// </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 ActivityService client</returns>
        public static ActivityServiceClient GetActivityServiceClient(System.ServiceModel.Channels.Binding binding, EndpointAddress endpointAddress, NetworkCredential credentials)
        {
            ActivityServiceClient client = new ActivityServiceClient(binding, endpointAddress);

            client.ClientCredentials.UserName.UserName = credentials.UserName;
            client.ClientCredentials.UserName.Password = credentials.Password;
            client.Endpoint.Behaviors.Add(new EmptyElementBehavior());
            return(client);
        }
Ejemplo n.º 2
0
        public void TestGetActivities()
        {
            ActivityServiceClient Cli = new ActivityServiceClient();

            try
            {
                List <Activity> la = Cli.getActivities();
                Assert.IsNotNull(la);
                Assert.AreEqual(1, la.Count);
            }
            catch (FaultException <ActivityFaultContract> Fe)
            {
                Debug.WriteLine(Fe.Reason);
                Debug.WriteLine(Fe.Detail.ErrorMessage);
                Debug.WriteLine(Fe.Detail.RequestTime);
                Debug.WriteLine(Fe.Detail.Method);
                Assert.Fail();
            }
        }
Ejemplo n.º 3
0
        public ActivityViewModel()
        {
            _Cli = new ActivityService.ActivityServiceClient();

            try
            {
                List <Activity>       la  = _Cli.getActivities(WPFActivityManager.Properties.Settings.Default.License);
                List <ActivityClient> lac = la.Select(l => ActivityClient.LoadFromService(l)).ToList();

                foreach (ActivityClient item in lac)
                {
                    LActivity.Add(item);
                }
            }
            catch (FaultException <ActivityFaultContract> Fe)
            {
                WpfUIWindowDialogService uiser = new WpfUIWindowDialogService();
                uiser.ShowDialog("Information", string.Format("{0} \r\n {1}", Fe.Reason, Fe.Detail.ErrorMessage));
            }
        }
        /// <summary>
        /// Tests a call to Activity Service
        /// </summary>
        static void TestActivityService()
        {
            Console.WriteLine("TestActivityService");
            System.ServiceModel.Channels.Binding binding = FaBindingFactory.GetUsernameTokenOverSslBinding();
            EndpointAddress       endpointAddress        = new EndpointAddress(new Uri("Url to the service"));
            ActivityServiceClient client = FaServiceFactory.GetActivityServiceClient(binding, endpointAddress, new NetworkCredential(userName, password));

            FusionApplicationAccelerator.ActivityServiceReference.FindCriteria findCriteria = new FusionApplicationAccelerator.ActivityServiceReference.FindCriteria();
            findCriteria.fetchSize  = 2;
            findCriteria.fetchStart = 0;
            string[] findAttributes = new string[1] {
                "ActivityId"
            };
            findCriteria.findAttribute = findAttributes;

            FusionApplicationAccelerator.ActivityServiceReference.FindControl findControl = new FusionApplicationAccelerator.ActivityServiceReference.FindControl();
            Activity[] result = client.findActivity(findCriteria, findControl);
            if (null != result && result.Length > 0)
            {
                foreach (Activity activity in result)
                {
                    Console.WriteLine("  activity = " + activity.ActivityId);
                }
            }
            else
            {
                if (null == result)
                {
                    Console.WriteLine("  activity null ");
                }
                else
                {
                    Console.WriteLine("  activity empty ");
                }
            }
        }
 /// <summary>
 /// Static method to obtain instance of the ActivityService
 /// </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 ActivityService client</returns>
 public static ActivityServiceClient GetActivityServiceClient(System.ServiceModel.Channels.Binding binding, EndpointAddress endpointAddress, NetworkCredential credentials)
 {
     ActivityServiceClient client = new ActivityServiceClient(binding, endpointAddress);
     client.ClientCredentials.UserName.UserName = credentials.UserName;
     client.ClientCredentials.UserName.Password = credentials.Password;
     client.Endpoint.Behaviors.Add(new EmptyElementBehavior());
     return client;
 }