コード例 #1
0
        private void authenticate()
        {
            AuthenticationTicket ticket = RemoteManager.Authenticate(ConfigurationManager.AppSettings["authenticationUrl"], ConfigurationManager.AppSettings["username"], ConfigurationManager.AppSettings["password"]);

            // Initialize RemoteManager
            RemoteManager.CreateInstance(ConfigurationManager.AppSettings["authenticationUrl"], ticket);
        }
コード例 #2
0
        static void Init()
        {
            AuthenticationTicket ticket;

            try
            {
                ticket = RemoteManager.Authenticate("http://dev.inriver.com:8080", "pimuser1", "pimuser1");
            }
            //catch (EndpointNotFoundException epEx)
            //{
            //    Console.WriteLine("Authentication failed for communication reason!");
            //    Console.WriteLine(string.Format("Error message: {0}", epEx.Message));
            //    Console.ReadLine();
            //    return;
            //}
            catch (SecurityException secEx)
            {
                Console.WriteLine("Authentication failed for Security reason!");
                Console.WriteLine(string.Format("Error message: {0}", secEx.Message));
                Console.ReadLine();
                return;
            }
            catch (AuthenticationException autEx)
            {
                Console.WriteLine("Authentication failed!");
                Console.WriteLine(string.Format("Error message: {0}", autEx.Message));
                Console.ReadLine();
                return;
            }
            catch (Exception ex)
            {
                Console.WriteLine("Authentication failed for unknown reason!");
                Console.WriteLine(string.Format("Error message: {0}", ex.Message));
                Console.ReadLine();
                return;
            }

            if (ticket == null)
            {
                Console.WriteLine("Authentication failed! No ticket created.");
                Console.ReadLine();
                return;
            }

            RemoteManager.CreateInstance("http://dev.inriver.com:8080", ticket);
        }
コード例 #3
0
        static void Main(string[] args)
        {
            //Set server and user details.
            var myServer   = "https://myinRiverServer:8080";
            var myUser     = "******";
            var myPassword = "******";
            var userToGetNotificationsFor = "inRiverUserNameToActivateNotifictaionFor";

            AuthenticationTicket ticket;

            try
            {
                ticket = RemoteManager.Authenticate(myServer, myUser, myPassword);
            }
            catch (EndpointNotFoundException epEx)
            {
                Console.WriteLine("Authentication failed for communication reason!");
                Console.WriteLine(string.Format("Error message: {0}", epEx.Message));
                Console.ReadLine();
                return;
            }
            catch (SecurityException secEx)
            {
                Console.WriteLine("Authentication failed for Security reason!");
                Console.WriteLine(string.Format("Error message: {0}", secEx.Message));
                Console.ReadLine();
                return;
            }
            catch (AuthenticationException autEx)
            {
                Console.WriteLine("Authentication failed!");
                Console.WriteLine(string.Format("Error message: {0}", autEx.Message));
                Console.ReadLine();
                return;
            }
            catch (Exception ex)
            {
                Console.WriteLine("Authentication failed for unknown reason!");
                Console.WriteLine(string.Format("Error message: {0}", ex.Message));
                Console.ReadLine();
                return;
            }

            if (ticket == null)
            {
                Console.WriteLine("Authentication failed! No ticket created.");
                Console.ReadLine();
                return;
            }

            RemoteManager.CreateInstance(myServer, ticket);
            Console.WriteLine("Authentication Succeeded. Now you can start using the inRiver Remoting API");
            //Console.ReadLine();

            //Get All Notifications For a specific User (see variable at the start of the )
            var myNotifications = RemoteManager.UtilityService.GetAllNotificationsForUser(userToGetNotificationsFor);

            //Activate all of the Notifiction statuses.
            foreach (var aNotification in myNotifications)
            {
                aNotification.Status = "Active";
                RemoteManager.UtilityService.UpdateNotificaton(aNotification);
            }

            //Fetch all of the Notifications again for the user and see that they are updated.
            myNotifications = RemoteManager.UtilityService.GetAllNotificationsForUser(userToGetNotificationsFor);
            myNotifications.ForEach(i => Console.WriteLine("{0}\t{1}\t", i.Status, i.Id));

            Console.ReadLine();
        }