Ejemplo n.º 1
0
        /// <summary>
        /// The initialize client.
        /// </summary>
        /// <param name="lmsDomain">
        /// The LMS domain.
        /// </param>
        /// <param name="client">
        /// The client.
        /// </param>
        /// <param name="error">
        /// The error.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        private bool InitializeClient(string lmsDomain, out WebserviceWrapper client, out string error)
        {
            client = new WebserviceWrapper(
                lmsDomain,
                VendorEgc,
                ProgramLti,
                TimeSpan.FromMinutes(1).Seconds,
                new CastleLoggerAdapter(_logger));

            if (HadError(client, out error))
            {
                return(false);
            }

            client.initialize_v1();
            return(!HadError(client, out error));
        }
Ejemplo n.º 2
0
        static public String[,] getData(String host, String vendor, String program, String secret, String username, string userpass, String logintype, String courseuser)
        {
            // If not logged in already...
            if (!loggedIn)
            {
                // Initialize and configure web service wrapper
                ws = new WebserviceWrapper(host, vendor, program, EXPECTED_LIFE);

                // Context.WS initialize to establish session and get session Id
                ws.initialize_v1();

                if (logintype.Equals("tool"))
                {
                    // Login as proxy Tool
                    loggedIn = ws.loginTool(secret);
                }
                else
                {
                    // Login as user
                    loggedIn = ws.loginUser(username, userpass);
                }

                if (!loggedIn)
                {
                    Console.WriteLine("Login " + logintype + " failed: " + ws.getLastError());
                    return(null);
                }
            }

            //Initialize the web service wrappers necessary for this sample
            initWrappers();

            // Get a list of courses for this user
            String[,] courseList = getCourseList(courseuser);

            // Return the courseList to the form for processing
            return(courseList);
        }
Ejemplo n.º 3
0
        static public Boolean registerTool(String host, String vendor, String program, String secret, String regpass)
        {
            // Configure and initialize Web Service Wrapper
            ws = new WebserviceWrapper(host, vendor, program, EXPECTED_LIFE);
            // Initialize the web service session. Under the covers, this takes care of Context.initialize()
            ws.initialize_v1();

            // Create a string array of requested entitlements. This is overkill for this sample.
            string [] tools = new string [] { "Announcement.WS:createCourseAnnouncements",
                                              "Announcement.WS:createOrgAnnouncements",
                                              "Announcement.WS:createSystemAnnouncements",
                                              "Announcement.WS:deleteCourseAnnouncements",
                                              "Announcement.WS:deleteOrgAnnouncements",
                                              "Announcement.WS:deleteSystemAnnouncements",
                                              "Announcement.WS:getCourseAnnouncements",
                                              "Announcement.WS:getOrgAnnouncements",
                                              "Announcement.WS:getSystemAnnouncements",
                                              "Announcement.WS:updateCourseAnnouncements",
                                              "Announcement.WS:updateOrgAnnouncements",
                                              "Announcement.WS:updateSystemAnnouncements",
                                              "Calendar.WS:canUpdateCourseCalendarItem",
                                              "Calendar.WS:canUpdateInstitutionCalendarItem",
                                              "Calendar.WS:canUpdatePersonalCalendarItem",
                                              "Calendar.WS:createCourseCalendarItem",
                                              "Calendar.WS:createInstitutionCalendarItem",
                                              "Calendar.WS:createPersonalCalendarItem",
                                              "Calendar.WS:deleteCourseCalendarItem",
                                              "Calendar.WS:deleteInstitutionCalendarItem",
                                              "Calendar.WS:deletePersonalCalendarItem",
                                              "Calendar.WS:getCalendarItem",
                                              "Calendar.WS:saveCourseCalendarItem",
                                              "Calendar.WS:saveInstitutionCalendarItem",
                                              "Calendar.WS:savePersonalCalendarItem",
                                              "Calendar.WS:updateCourseCalendarItem",
                                              "Calendar.WS:updateInstitutionCalendarItem",
                                              "Calendar.WS:updatePersonalCalendarItem",
                                              "Content.WS:addContentFile",
                                              "Content.WS:deleteContentFiles",
                                              "Content.WS:deleteContents",
                                              "Content.WS:deleteCourseTOCs",
                                              "Content.WS:deleteLinks",
                                              "Content.WS:getContentFiles",
                                              "Content.WS:getFilteredContent",
                                              "Content.WS:getFilteredCourseStatus",
                                              "Content.WS:getLinksByReferredToType",
                                              "Content.WS:getLinksByReferrerType",
                                              "Content.WS:getReviewStatusByCourseId",
                                              "Content.WS:getTOCsByCourseId",
                                              "Content.WS:loadContent",
                                              "Content.WS:removeContent",
                                              "Content.WS:saveContent",
                                              "Content.WS:saveContentsReviewed",
                                              "Content.WS:saveCourseTOC",
                                              "Content.WS:saveLink",
                                              "Context.WS:emulateUser",
                                              "Context.WS:getMemberships",
                                              "Context.WS:getMyMemberships",
                                              "Course.WS:changeCourseBatchUid",
                                              "Course.WS:changeCourseCategoryBatchUid",
                                              "Course.WS:changeCourseDataSourceId",
                                              "Course.WS:changeOrgBatchUid",
                                              "Course.WS:changeOrgCategoryBatchUid",
                                              "Course.WS:changeOrgDataSourceId",
                                              "Course.WS:createCourse",
                                              "Course.WS:createOrg",
                                              "Course.WS:deleteCartridge",
                                              "Course.WS:deleteCourse",
                                              "Course.WS:deleteCourseCategory",
                                              "Course.WS:deleteCourseCategoryMembership",
                                              "Course.WS:deleteGroup",
                                              "Course.WS:deleteOrg",
                                              "Course.WS:deleteOrgCategory",
                                              "Course.WS:deleteOrgCategoryMembership",
                                              "Course.WS:deleteStaffInfo",
                                              "Course.WS:getAvailableGroupTools",
                                              "Course.WS:getCartridge",
                                              "Course.WS:getCategories",
                                              "Course.WS:getCategoryMembership",
                                              "Course.WS:getClassifications",
                                              "Course.WS:getCourse",
                                              "Course.WS:getGroup",
                                              "Course.WS:getOrg",
                                              "Course.WS:getStaffInfo",
                                              "Course.WS:saveCartridge",
                                              "Course.WS:saveCourse",
                                              "Course.WS:saveCourseCategory",
                                              "Course.WS:saveCourseCategoryMembership",
                                              "Course.WS:saveGroup",
                                              "Course.WS:saveOrgCategory",
                                              "Course.WS:saveOrgCategoryMembership",
                                              "Course.WS:saveStaffInfo",
                                              "Course.WS:updateCourse",
                                              "Course.WS:updateOrg",
                                              "Course.WS:loadCoursesInTerm",
                                              "Course.WS:addCourseToTerm",
                                              "Course.WS:removeCourseFromTerm",
                                              "Course.WS:loadTerm",
                                              "Course.WS:loadTermByCourseId",
                                              "Course.WS:saveTerm",
                                              "Course.WS:removeTerm",
                                              "Course.WS:loadTerms",
                                              "Course.WS:loadTermsByName",
                                              "CourseMembership.WS:deleteCourseMembership",
                                              "CourseMembership.WS:deleteGroupMembership",
                                              "CourseMembership.WS:getCourseMembership",
                                              "CourseMembership.WS:getCourseRoles",
                                              "CourseMembership.WS:getGroupMembership",
                                              "CourseMembership.WS:saveCourseMembership",
                                              "CourseMembership.WS:saveGroupMembership",
                                              "Gradebook.WS:deleteAttempts",
                                              "Gradebook.WS:deleteColumns",
                                              "Gradebook.WS:deleteGradebookTypes",
                                              "Gradebook.WS:deleteGrades",
                                              "Gradebook.WS:deleteGradingSchemas",
                                              "Gradebook.WS:getAttempts",
                                              "Gradebook.WS:getGradebookColumns",
                                              "Gradebook.WS:getGradebookTypes",
                                              "Gradebook.WS:getGrades",
                                              "Gradebook.WS:getGradingSchemas",
                                              "Gradebook.WS:saveAttempts",
                                              "Gradebook.WS:saveColumns",
                                              "Gradebook.WS:saveGradebookTypes",
                                              "Gradebook.WS:saveGrades",
                                              "Gradebook.WS:saveGradingSchemas",
                                              "Gradebook.WS:updateColumnAttribute",
                                              "User.WS:changeUserBatchUid",
                                              "User.WS:changeUserDataSourceId",
                                              "User.WS:deleteAddressBookEntry",
                                              "User.WS:deleteObserverAssociation",
                                              "User.WS:deleteUser",
                                              "User.WS:deleteUserByInstitutionRole",
                                              "User.WS:getAddressBookEntry",
                                              "User.WS:getInstitutionRoles",
                                              "User.WS:getObservee",
                                              "User.WS:getSystemRoles",
                                              "User.WS:getUser",
                                              "User.WS:getUserInstitutionRoles",
                                              "User.WS:saveAddressBookEntry",
                                              "User.WS:saveObserverAssociation",
                                              "User.WS:saveUser",
                                              "Util.WS:checkEntitlement",
                                              "Util.WS:deleteSetting",
                                              "Util.WS:getDataSources",
                                              "Util.WS:loadSetting",
                                              "Util.WS:saveSetting" };

            // Create empty tickets array.
            string [] tickets = null;

            // Register the proxy tool.
            RegisterToolResultVO result = ws.registerTool("Blackboard Developer Experience C-Sharp Sample Tool", regpass, secret, tools, tickets);

            // If registration is successful
            if (result.status)
            {
                Console.WriteLine("Success - tool registered");
                string proxyToolGuid = result.proxyToolGuid;
                if (proxyToolGuid != null && proxyToolGuid.Length > 0)
                {
                    Console.WriteLine("Proxy Tool GUID: " + proxyToolGuid);
                }
                return(true);
            }
            else
            {
                Console.WriteLine("Failed  - tool not registered (to re-register you must clear the password on the server):");
                for (int i = 0; i < result.failureErrors.Length; i++)
                {
                    Console.WriteLine(result.failureErrors[i]);
                }
                Console.WriteLine(ws.getLastError());
                return(false);
            }
        }