public void SetAppLrsAuthCallbackUrl(String lrsAuthCallbackUrl)
        {
            ServiceRequest request = new ServiceRequest(configuration);
            request.Parameters.Add("lrsAuthCallbackUrl", lrsAuthCallbackUrl);

            request.CallService("rustici.lrsaccount.setAppLrsAuthCallbackUrl");
        }
        /// <summary>
        /// Create a new Registration (Instance of a user taking a course)
        /// </summary>
        /// <param name="registrationId">Unique Identifier for the registration</param>
        /// <param name="courseId">Unique Identifier for the course</param>
        /// <param name="versionId">Optional versionID, if Int32.MinValue, latest course version is used.</param>
        /// <param name="learnerId">Unique Identifier for the learner</param>
        /// <param name="learnerFirstName">Learner's first name</param>
        /// <param name="learnerLastName">Learner's last name</param>
        /// <param name="resultsPostbackUrl">URL to which the server will post results back to</param>
        /// <param name="authType">Type of Authentication used at results postback time</param>
        /// <param name="postBackLoginName">If postback authentication is used, the logon name</param>
        /// <param name="postBackLoginPassword">If postback authentication is used, the password</param>
        /// <param name="resultsFormat">The Format of the results XML sent to the postback URL</param>
        public void CreateRegistration(string registrationId, string courseId, int versionId, string learnerId,
            string learnerFirstName, string learnerLastName, string resultsPostbackUrl,
            RegistrationResultsAuthType authType, string postBackLoginName, string postBackLoginPassword,
            RegistrationResultsFormat resultsFormat)
        {
            ServiceRequest request = new ServiceRequest(configuration);
            request.Parameters.Add("regid", registrationId);
            request.Parameters.Add("courseid", courseId);
            request.Parameters.Add("fname", learnerFirstName);
            request.Parameters.Add("lname", learnerLastName);
            request.Parameters.Add("learnerid", learnerId);

            // Required on this signature but not by the actual service
            request.Parameters.Add("authtype", Enum.GetName(authType.GetType(), authType).ToLower());
            request.Parameters.Add("resultsformat", Enum.GetName(resultsFormat.GetType(), resultsFormat).ToLower());

            // Optional:
            if (!String.IsNullOrEmpty(resultsPostbackUrl))
                request.Parameters.Add("postbackurl", resultsPostbackUrl);
            if (!String.IsNullOrEmpty(postBackLoginName))
                request.Parameters.Add("urlname", postBackLoginName);
            if (!String.IsNullOrEmpty(postBackLoginPassword))
                request.Parameters.Add("urlpass", postBackLoginPassword);
            if (versionId != Int32.MinValue)
                request.Parameters.Add("versionid", versionId);

            request.CallService("rustici.registration.createRegistration");
        }
 /// <summary>
 /// Calling this method will start a new data export, and return an id 
 /// that can be used to check on the status of the export using a call to Status
 /// </summary>
 /// <returns>The unique id for the started data export</returns>
 public string Start()
 {
     ServiceRequest sr = new ServiceRequest(this.configuration);
     XmlDocument response = sr.CallService("rustici.export.start");
     XmlElement elem = (XmlElement)response.GetElementsByTagName("export_id")[0];
     return elem.InnerText;
 }
 /// <summary>
 /// Calling this method will cancel the export with the passed in export id.
 /// </summary>
 /// <param name="exportId"></param>
 /// <returns>True if successfully canceled</returns>
 public bool Cancel(String exportId)
 {
     ServiceRequest sr = new ServiceRequest(this.configuration);
     sr.Parameters.Add("exportid", exportId);
     sr.CallService("rustici.export.cancel");
     return true;
 }
 /* LEARNER RELATED */
 public string SetLearnerTags(string learnerID, string learnerTags)
 {
     ServiceRequest request = new ServiceRequest(configuration);
     request.Parameters.Add("learnerid", learnerID);
     request.Parameters.Add("tags", learnerTags);
     XmlDocument response = request.CallService("rustici.tagging.setLearnerTags");
     return response.InnerXml;
 }
        /// <summary>
        /// Change the accessibility status of the invitation
        /// </summary>
        /// <param name="invitationId">invitationId of the invite in question</param>
        /// <param name="enable">whether to set the invite as launchable</param>
        /// <param name="open">whether new regs can be created against the invite (for public invites only)</param>
        public void ChangeStatus(String invitationId, bool enable, bool open)
        {
            ServiceRequest request = new ServiceRequest(configuration);
            request.Parameters.Add("invitationId", invitationId);
            request.Parameters.Add("enable", enable.ToString().ToLower());
            request.Parameters.Add("open", open.ToString().ToLower());

            request.CallService("rustici.invitation.changeStatus");
        }
 /// <summary>
 /// Creates a new FTP User
 /// </summary>
 /// <param name="userId">User ID</param>
 /// <param name="userPass">User's Password</param>
 /// <param name="permissionDomain">permission domain for the new user</param>
 public void CreateUser(string userId, string userPass, string permissionDomain)
 {
     ServiceRequest request = new ServiceRequest(configuration);
     request.Parameters.Add("userid", userId);
     request.Parameters.Add("userpass", userPass);
     if (!String.IsNullOrEmpty(permissionDomain))
         request.Parameters.Add("pd", permissionDomain);
     request.CallService("rustici.ftp.createUser");
 }
        /// <summary>
        /// Creates a new instance of an existing registration.  This essentially creates a
        /// fresh take of a course by the user. The latest version of the associated course
        /// will be used.
        /// </summary>
        /// <param name="registrationId">Unique Identifier for the registration</param>
        /// <returns>Instance ID of the newly created instance</returns>
        public int CreateNewInstance(string registrationId)
        {
            ServiceRequest request = new ServiceRequest(configuration);
              request.Parameters.Add("regid", registrationId);
              XmlDocument response = request.CallService("rustici.registration.createNewInstance");

              XmlNodeList successNodes = response.GetElementsByTagName("success");
              return Convert.ToInt32(successNodes[0].Attributes["instanceid"].Value);
        }
 public String GetReportageAuth(ReportageNavPermission navPermission, bool isAdmin)
 {
     ServiceRequest request = new ServiceRequest(configuration);
     request.Parameters.Add("navpermission", navPermission.ToString().ToLower());
     request.Parameters.Add("admin", isAdmin.ToString().ToLower());
     XmlDocument response = request.CallService("rustici.reporting.getReportageAuth");
     XmlNode authNode = response.GetElementsByTagName("auth")[0];
     return authNode.InnerText;
 }
 /// <summary>
 /// List of existing dispatch destinations in your account. Callers should assume
 /// another page of data is available by calling again with the page parameter
 /// incremented, until an empty list is returned.
 /// </summary>
 /// <param name="page">Which page of results to return. Page numbers start at 1.</param>
 /// <param name="tags">A comma separated list of tags to filter results by. Results must be tagged with every tag in the list.</param>
 /// <returns>List of Destination Data objects.</returns>
 public List<DestinationData> GetDestinationList(int page, string tags)
 {
     ServiceRequest request = new ServiceRequest(configuration);
     request.Parameters.Add("page", page);
     if (!string.IsNullOrEmpty(tags))
         request.Parameters.Add("tags", tags);
     XmlDocument response = request.CallService("rustici.dispatch.getDestinationList");
     return DestinationData.ConvertToDestinationDataList(response);
 }
        public string AddOrRemoveLearnerTag(string learnerID, string learnerTag, string ADD_or_REMOVE)
        {
            ServiceRequest request = new ServiceRequest(configuration);
            request.Parameters.Add("learnerid", learnerID);
            request.Parameters.Add("tag", learnerTag);

            string serviceToCall = "addLearnerTag";
            if (ADD_or_REMOVE == "REMOVE") serviceToCall = "removeLearnerTag";
            XmlDocument response = request.CallService("rustici.tagging." + serviceToCall);

            return response.InnerXml;
        }
     /// <summary>
     /// Calling this method returns a URL which will authenticate and launch a Reportage session, starting
     /// at the specified Reportage URL entry point.
     /// </summary>
     /// <returns>A URL from which the export data can be downloaded</returns>
     public String GetReportUrl(String reportageAuth, String reportUrl)
     {
         ServiceRequest request = new ServiceRequest(configuration);
 	    //Relative path, auto add the right server name
 	    string fullReportUrl = reportUrl;
         if (reportUrl.StartsWith("/Reportage"))
         {
             fullReportUrl = "http://" + request.Server + reportUrl;
         }
         request.Parameters.Add("auth", reportageAuth);
         request.Parameters.Add("reporturl", fullReportUrl);
 	    return request.ConstructUrl("rustici.reporting.launchReport");
     }
 /// <summary>
 /// Create a new Dispatch Destination in your SCORM Cloud account.
 /// </summary>
 /// <param name="name">The name of the new destination.</param>
 /// <param name="tags">A comma separated list of tags to add to this destination.</param>
 /// <param name="email">The email address associated with the user creating this destination.</param>
 /// <returns>The id for the newly created destination.</returns>
 public string CreateDestination(string name, string tags, string email)
 {
     ServiceRequest request = new ServiceRequest(configuration);
     request.Parameters.Add("name", name);
     if (!string.IsNullOrEmpty(tags))
         request.Parameters.Add("tags", tags);
     if (!string.IsNullOrEmpty(email))
         request.Parameters.Add("email", email);
     XmlDocument response = request.CallService("rustici.dispatch.createDestination");
     String destinationId = ((XmlElement)response
                             .GetElementsByTagName("destinationId")[0])
                             .FirstChild.InnerText;
     return destinationId;
 }
        public string[] GetLearnerTags(string learnerID)
        {
            ServiceRequest request = new ServiceRequest(configuration);
            request.Parameters.Add("learnerid", learnerID);            
            XmlDocument tagsXMLDoc = request.CallService("rustici.tagging.getLearnerTags");
            XmlNodeList tagNodes = tagsXMLDoc.GetElementsByTagName("tag");
            string[] tags = new string[tagNodes.Count];

            for (int t = 0; t < tagNodes.Count; t++)
            {
                string nextTag = tagNodes[t].InnerText;
                tags[t] = nextTag;
            }

            return tags;
        }
Example #15
0
        /// <summary>
        /// Import a SCORM .pif (zip file) asynchronously from the local filesystem.
        /// </summary>
        /// <param name="courseId">Unique Identifier for this course.</param>
        /// <param name="absoluteFilePathToZip">Full path to the .zip file</param>
        /// <param name="itemIdToImport">ID of manifest item to import. If null, root organization is imported</param>
        /// <param name="permissionDomain">A permission domain to associate this course with,
        /// for ftp access service (see ftp service below).
        /// If the domain specified does not exist, the course will be placed in the default permission domain</param>
        /// <returns>Token ID of Asynchronous Import</returns>
        public String ImportCourseAsync(string courseId, string absoluteFilePathToZip,
                                        string itemIdToImport, string permissionDomain)
        {
            ServiceRequest request = new ServiceRequest(configuration);

            request.Parameters.Add("courseid", courseId);
            if (!String.IsNullOrEmpty(itemIdToImport))
            {
                request.Parameters.Add("itemid", itemIdToImport);
            }
            if (!String.IsNullOrEmpty(itemIdToImport))
            {
                request.Parameters.Add("pd", permissionDomain);
            }
            request.FileToPost = absoluteFilePathToZip;
            XmlDocument response = request.CallService("rustici.course.importCourseAsync");
            String      tokenId  = ((XmlElement)response
                                    .GetElementsByTagName("token")[0])
                                   .FirstChild.InnerText;

            return(tokenId);
        }
Example #16
0
        /// <summary>
        /// Delete the selected dispatches from your SCORM Cloud account, using the parameters given.
        /// Selection of dispatches to delete is based either on a specific dispatch using the
        /// dispatchid parameter, or groups of dispatches using the destinationid, courseid, or
        /// tags parameters in any combination.
        /// </summary>
        /// <param name="dispatchId">The id of the dispatch being deleted.</param>
        /// <param name="destinationId">The id of the destination used to select the dispatch group to delete.</param>
        /// <param name="courseId">The id of the course used to select the dispatch group to delete.</param>
        /// <param name="tags">A comma separated list of tags used to select the dispatch group to delete. Each dispatch selected will have to be tagged with each tag in the list.</param>
        public void DeleteDispatches(string dispatchId, string destinationId, string courseId, string tags)
        {
            ServiceRequest request = new ServiceRequest(configuration);

            if (!string.IsNullOrEmpty(dispatchId))
            {
                request.Parameters.Add("dispatchid", dispatchId);
            }
            if (!string.IsNullOrEmpty(destinationId))
            {
                request.Parameters.Add("destinationid", destinationId);
            }
            if (!string.IsNullOrEmpty(courseId))
            {
                request.Parameters.Add("courseid", courseId);
            }
            if (!string.IsNullOrEmpty(tags))
            {
                request.Parameters.Add("tags", tags);
            }

            request.CallService("rustici.dispatch.deleteDispatches");
        }
Example #17
0
        /// <summary>
        /// Create a new Registration (Instance of a user taking a course)
        /// </summary>
        /// <param name="registrationId">Unique Identifier for the registration</param>
        /// <param name="courseId">Unique Identifier for the course</param>
        /// <param name="versionId">Optional versionID, if Int32.MinValue, latest course version is used.</param>
        /// <param name="learnerId">Unique Identifier for the learner</param>
        /// <param name="learnerFirstName">Learner's first name</param>
        /// <param name="learnerLastName">Learner's last name</param>
        /// <param name="resultsPostbackUrl">URL to which the server will post results back to</param>
        /// <param name="authType">Type of Authentication used at results postback time</param>
        /// <param name="postBackLoginName">If postback authentication is used, the logon name</param>
        /// <param name="postBackLoginPassword">If postback authentication is used, the password</param>
        /// <param name="resultsFormat">The Format of the results XML sent to the postback URL</param>
        public void CreateRegistration(string registrationId, string courseId, int versionId, string learnerId,
                                       string learnerFirstName, string learnerLastName, string resultsPostbackUrl,
                                       RegistrationResultsAuthType authType, string postBackLoginName, string postBackLoginPassword,
                                       RegistrationResultsFormat resultsFormat)
        {
            ServiceRequest request = new ServiceRequest(configuration);

            request.Parameters.Add("regid", registrationId);
            request.Parameters.Add("courseid", courseId);
            request.Parameters.Add("fname", learnerFirstName);
            request.Parameters.Add("lname", learnerLastName);
            request.Parameters.Add("learnerid", learnerId);

            // Required on this signature but not by the actual service
            request.Parameters.Add("authtype", Enum.GetName(authType.GetType(), authType).ToLower());
            request.Parameters.Add("resultsformat", Enum.GetName(resultsFormat.GetType(), resultsFormat).ToLower());

            // Optional:
            if (!String.IsNullOrEmpty(resultsPostbackUrl))
            {
                request.Parameters.Add("postbackurl", resultsPostbackUrl);
            }
            if (!String.IsNullOrEmpty(postBackLoginName))
            {
                request.Parameters.Add("urlname", postBackLoginName);
            }
            if (!String.IsNullOrEmpty(postBackLoginPassword))
            {
                request.Parameters.Add("urlpass", postBackLoginPassword);
            }
            if (versionId != Int32.MinValue)
            {
                request.Parameters.Add("versionid", versionId);
            }

            request.CallService("rustici.registration.createRegistration");
        }
Example #18
0
        /// <summary>
        /// Uses the dispatches selected by the given parameters to create and deliver a package
        /// containing the resources used to import and launch those dispatches in client systems.
        /// This will save a zip file, which in turn contains zip files for each of the selected dispatches.
        /// </summary>
        /// <param name="toFileName">File to save download to.</param>
        /// <param name="dispatchId">The id of the dispatch to download.</param>
        /// <param name="destinationId">The id of the destination used to select the dispatch group to download.</param>
        /// <param name="courseId">The id of the course used to select the dispatch group to download.</param>
        /// <param name="tags">A comma separated list of tags used to select the dispatch group to download. Each dispatch selected will have to be tagged with each tag in the list.</param>
        /// <returns>Dispatch Data object.</returns>
        public string DownloadDispatches(string toFileName, string dispatchId, string destinationId, string courseId, string tags)
        {
            ServiceRequest request = new ServiceRequest(configuration);

            if (!string.IsNullOrEmpty(dispatchId))
            {
                request.Parameters.Add("dispatchid", dispatchId);
            }
            if (!string.IsNullOrEmpty(destinationId))
            {
                request.Parameters.Add("destinationid", destinationId);
            }
            if (!string.IsNullOrEmpty(courseId))
            {
                request.Parameters.Add("courseid", courseId);
            }
            if (!string.IsNullOrEmpty(tags))
            {
                request.Parameters.Add("tags", tags);
            }

            //Return file path to downloaded file
            return(request.GetFileFromService(toFileName, "rustici.dispatch.downloadDispatches"));
        }
Example #19
0
        /// <summary>
        /// This method provides a way to test a URL for posting registration results back to, as they would be posted when using the postbackurl in the createRegistration call. When called, an example registration result will be posted to the URL given, or else an error will be reported regarding why the post failed.
        /// </summary>
        /// <param name="postbackUrl">Specifies a URL for which to post activity and status data in real time as the course is completed</param>
        /// <param name="authType">Optional parameter to specify how to authorize against the given postbackurl, can be "form" or "httpbasic". If form authentication, the username and password for authentication are submitted as form fields "username" and "password", and the registration data as the form field "data". If httpbasic authentication is used, the username and password are placed in the standard Authorization HTTP header, and the registration data is the body of the message (sent as text/xml content type). This field is set to "form" by default.</param>
        /// <param name="urlname">You can optionally specify a login name to be used for credentials when posting to the URL specified in postbackurl</param>
        /// <param name="urlpass">If credentials for the postbackurl are provided, this must be included, it is the password to be used in authorizing the postback of data to the URL specified by postbackurl</param>
        /// <param name="resultsFormat">This parameter allows you to specify a level of detail in the information that is posted back while the course is being taken. It may be one of three values: "course" (course summary), "activity" (activity summary, or "full" (full detail), and is set to "course" by default. The information will be posted as xml, and the format of that xml is specified below under the method "getRegistrationResult"</param>
        /// <returns>Rsp containing result and status code</returns>
        public Rsp TestRegistrationPostUrl(string postbackUrl, RegistrationResultsAuthType authType, string urlname, string urlpass, RegistrationResultsFormat resultsFormat)
        {
            ServiceRequest request = new ServiceRequest(configuration);

            request.Parameters.Add("postbackurl", postbackUrl);

            if (!String.IsNullOrEmpty(urlname))
            {
                request.Parameters.Add("urlname", urlname);
            }

            if (!String.IsNullOrEmpty(urlpass))
            {
                request.Parameters.Add("urlpass", urlpass);
            }

            request.Parameters.Add("authtype", Enum.GetName(authType.GetType(), authType).ToLower());
            request.Parameters.Add("resultsformat", Enum.GetName(resultsFormat.GetType(), resultsFormat).ToLower());

            XmlDocument response   = request.CallService("rustici.registration.testRegistrationPostUrl");
            XmlElement  rspElement = ((XmlElement)response.GetElementsByTagName("rsp")[0]);

            return(new Rsp(rspElement));
        }
        /// <summary>
        /// Semantics: This method provides a way to update the postback settings for a registration created with the createRegistration call. If you wish to change an authenticated postback to an unauthenticated postback, please call this method with only a url specified.
        /// </summary>
        /// <param name="registrationId">Unique Identifier for the registration</param>
        /// <param name="courseId">Unique Identifier for the course</param>
        /// <param name="versionId">Optional versionID, if Int32.MinValue, latest course version is used.</param>
        /// <param name="learnerId">Unique Identifier for the learner</param>
        /// <param name="learnerFirstName">Learner's first name</param>
        /// <param name="learnerLastName">Learner's last name</param>
        /// <param name="resultsPostbackUrl">URL to which the server will post results back to</param>
        /// <param name="authType">Type of Authentication used at results postback time</param>
        /// <param name="postBackLoginName">If postback authentication is used, the logon name</param>
        /// <param name="postBackLoginPassword">If postback authentication is used, the password</param>
        /// <param name="resultsFormat">The Format of the results XML sent to the postback URL</param>
        public void UpdatePostbackInfo(string registrationId, string resultsPostbackUrl,
            string postBackLoginName, string postBackLoginPassword, RegistrationResultsAuthType authType,
            RegistrationResultsFormat resultsFormat)
        {
            ServiceRequest request = new ServiceRequest(configuration);
              request.Parameters.Add("regid", registrationId);
              request.Parameters.Add("url", "[" + HttpUtility.UrlEncode(resultsPostbackUrl) + "]");

              // Required on this signature but not by the actual service
              request.Parameters.Add("authtype", Enum.GetName(authType.GetType(), authType).ToLower());
              request.Parameters.Add("resultformat", Enum.GetName(resultsFormat.GetType(), resultsFormat).ToLower());

              // Optional:
              if (!String.IsNullOrEmpty(postBackLoginName))
              {
            request.Parameters.Add("name", postBackLoginName);
              }
              else
              {
            request.Parameters.Add("name", "PlaceholderName");
              }

              if (!String.IsNullOrEmpty(postBackLoginPassword))
              {
            request.Parameters.Add("password", postBackLoginPassword);
              }
              else
              {
            request.Parameters.Add("password", "PlaceholderPassword");
              }
              request.CallService("rustici.registration.updatePostbackInfo");
        }
        /// <summary>
        /// This method provides a way to test a URL for posting registration results back to, as they would be posted when using the postbackurl in the createRegistration call. When called, an example registration result will be posted to the URL given, or else an error will be reported regarding why the post failed.
        /// </summary>
        /// <param name="postbackUrl">Specifies a URL for which to post activity and status data in real time as the course is completed</param>
        /// <param name="authType">Optional parameter to specify how to authorize against the given postbackurl, can be "form" or "httpbasic". If form authentication, the username and password for authentication are submitted as form fields "username" and "password", and the registration data as the form field "data". If httpbasic authentication is used, the username and password are placed in the standard Authorization HTTP header, and the registration data is the body of the message (sent as text/xml content type). This field is set to "form" by default.</param>
        /// <param name="urlname">You can optionally specify a login name to be used for credentials when posting to the URL specified in postbackurl</param>
        /// <param name="urlpass">If credentials for the postbackurl are provided, this must be included, it is the password to be used in authorizing the postback of data to the URL specified by postbackurl</param>
        /// <param name="resultsFormat">This parameter allows you to specify a level of detail in the information that is posted back while the course is being taken. It may be one of three values: "course" (course summary), "activity" (activity summary, or "full" (full detail), and is set to "course" by default. The information will be posted as xml, and the format of that xml is specified below under the method "getRegistrationResult"</param>
        /// <returns>Rsp containing result and status code</returns>
        public Rsp TestRegistrationPostUrl(string postbackUrl, RegistrationResultsAuthType authType, string urlname, string urlpass, RegistrationResultsFormat resultsFormat)
        {
            ServiceRequest request = new ServiceRequest(configuration);
              request.Parameters.Add("postbackurl", postbackUrl);

              //Api call will fail without a placeholder username and password at least:
              if (!String.IsNullOrEmpty(urlname))
              {
            request.Parameters.Add("name", urlname);
              }
              else
              {
            request.Parameters.Add("name", "placeholderLoginName");
              }

              if (!String.IsNullOrEmpty(urlpass))
              {
            request.Parameters.Add("password", urlpass);
              }
              else
              {
            request.Parameters.Add("password", "placeholderLoginPassword");
              }

              request.Parameters.Add("authtype", Enum.GetName(authType.GetType(), authType).ToLower());
              request.Parameters.Add("resultformat", Enum.GetName(resultsFormat.GetType(), resultsFormat).ToLower());

              XmlDocument response = request.CallService("rustici.registration.testRegistrationPostUrl");
              XmlElement rspElement = ((XmlElement)response.GetElementsByTagName("rsp")[0]);
              return new Rsp(rspElement);
        }
 /// <summary>
 /// Resets all status data regarding the specified registration -- essentially restarts the course
 /// </summary>
 /// <param name="registrationId">Unique Identifier for the registration</param>
 public void ResetRegistration(string registrationId)
 {
     ServiceRequest request = new ServiceRequest(configuration);
       request.Parameters.Add("regid", registrationId);
       request.CallService("rustici.registration.resetRegistration");
 }
 /// <summary>
 /// Clears global objective data for the given registration
 /// </summary>
 /// <param name="registrationId">Unique Identifier for the registration</param>
 /// <param name="deleteLatestInstanceOnly">If false, all instances are deleted</param>
 public void ResetGlobalObjectives(string registrationId, bool deleteLatestInstanceOnly)
 {
     ServiceRequest request = new ServiceRequest(configuration);
       request.Parameters.Add("regid", registrationId);
       if (deleteLatestInstanceOnly)
     request.Parameters.Add("instanceid", "latest");
       request.CallService("rustici.registration.resetGlobalObjectives");
 }
 public virtual void caseSetup()
 {
     req      = svc.CreateNewRequest();
     courseId = Guid.NewGuid().ToString();
     regId    = Guid.NewGuid().ToString();
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="courseId">courseId of the course invited to</param>
        /// <param name="publicInvitation">whether the invite is public</param>
        /// <param name="send">whether to send the nvite</param>
        /// <param name="addresses">comma-separated list of email addresses to sent he invite to</param>
        /// <param name="emailSubject">subject of the email</param>
        /// <param name="emailBody">message body of the email</param>
        /// <param name="creatingUserEmail">email of the SCORM Cloud user creating the invite</param>
        /// <param name="registrationCap">the max number of public invitations to make available</param>
        /// <param name="postbackUrl">url to post back invite regs to</param>
        /// <param name="authType">auth type for postbacks</param>
        /// <param name="urlName">username for postbacks</param>
        /// <param name="urlPass">password for postbacks</param>
        /// <param name="resultsFormat">results format for postbacks</param>
        /// <param name="async">whether to send the (private) invites asynchronously</param>
        /// <returns>new invitation id</returns>
        public string CreateInvitation(string courseId, bool publicInvitation, bool send,
            string addresses, string emailSubject, string emailBody, string creatingUserEmail, int registrationCap,
            string postbackUrl, string authType, string urlName, string urlPass, string resultsFormat,
            bool async)
        {
            ServiceRequest request = new ServiceRequest(configuration);
            request.Parameters.Add("courseid", courseId);
            request.Parameters.Add("public", publicInvitation.ToString().ToLower());
            request.Parameters.Add("send", send.ToString().ToLower());
        
            request.Parameters.Add("registrationCap", registrationCap);
            
            if (addresses != null && addresses.Length > 0)
                request.Parameters.Add("addresses", addresses);
            if (emailSubject != null && emailSubject.Length > 0)
                request.Parameters.Add("emailSubject", emailSubject);
            if (emailBody != null && emailBody.Length > 0)
                request.Parameters.Add("emailBody", emailBody);
            if (creatingUserEmail != null && creatingUserEmail.Length > 0)
                request.Parameters.Add("creatingUserEmail", creatingUserEmail);
            if (postbackUrl != null && postbackUrl.Length > 0)
                request.Parameters.Add("postbackurl", postbackUrl);
            if (authType != null && authType.Length > 0)
                request.Parameters.Add("authtype", authType);
            if (urlName != null && urlName.Length > 0)
                request.Parameters.Add("urlname", urlName);
            if (urlPass != null && urlPass.Length > 0)
                request.Parameters.Add("urlpass", urlPass);
            if (resultsFormat != null && resultsFormat.Length > 0)
                request.Parameters.Add("resultsformat", resultsFormat);
        
            if (async){
        	    return request.CallService("rustici.invitation.createInvitationAsync").DocumentElement.InnerText;
            } else {
                return request.CallService("rustici.invitation.createInvitation").DocumentElement.InnerText;
            }

        }
        /// <summary>
        /// Get the invitation info for the invite
        /// </summary>
        /// <param name="invitationId">invitationId of invite inquiring about</param>
        /// <param name="includeRegistrationSummary">whether to include reg summaries for any user invitations returned</param>
        /// <returns>invitation info object</returns>
        public InvitationInfo GetInvitationInfo(string invitationId, bool includeRegistrationSummary) 
        {
            ServiceRequest request = new ServiceRequest(configuration);
            request.Parameters.Add("invitationId", invitationId);
            request.Parameters.Add("detail", includeRegistrationSummary.ToString().ToLower());

            XmlDocument response = request.CallService("rustici.invitation.getInvitationInfo");
            return new InvitationInfo((XmlElement)response.GetElementsByTagName("invitationInfo").Item(0));
	    }
        /// <summary>
        /// Returns a list of registration id's along with their associated course
        /// </summary>
        /// <param name="regIdFilterRegex">Optional registration id filter</param>
        /// <param name="courseIdFilterRegex">Option course id filter</param>
        /// <returns></returns>
        public List<RegistrationData> GetRegistrationList(string regIdFilterRegex, string courseIdFilterRegex, bool courseIdIsExact, DateTime? after, DateTime? until)
        {
            ServiceRequest request = new ServiceRequest(configuration);
              if (!String.IsNullOrEmpty(regIdFilterRegex))
            request.Parameters.Add("filter", regIdFilterRegex);
              if (!String.IsNullOrEmpty(courseIdFilterRegex))
              {
            request.Parameters.Add((courseIdIsExact ? "courseid" : "coursefilter"), courseIdFilterRegex);
              }
              if (after != null)
            request.Parameters.Add("after", after.GetValueOrDefault().ToUniversalTime());
              if (until != null)
            request.Parameters.Add("until", until.GetValueOrDefault().ToUniversalTime());

              XmlDocument response = request.CallService("rustici.registration.getRegistrationList");

              // Return the subset of the xml starting with the top <summary>
              return RegistrationData.ConvertToRegistrationDataList(response);
        }
        /// <summary>
        /// Return a registration detail object for the given registration
        /// </summary>
        /// <param name="registrationId">The unique identifier of the registration</param>
        /// <returns></returns>
        public RegistrationData GetRegistrationDetail(string registrationId)
        {
            ServiceRequest request = new ServiceRequest(configuration);

              request.Parameters.Add("regid", registrationId);

              XmlDocument response = request.CallService("rustici.registration.getRegistrationDetail");

              XmlElement reportElem = (XmlElement)response.GetElementsByTagName("registration")[0];

              return new RegistrationData(reportElem);
        }
 /// <summary>
 ///  Get the postback attributes that were set in a createRegistration or updatePostbackInfo call.
 /// </summary>
 /// <param name="registrationId">Specifies the registration id</param>
 /// <returns>PostackInfo</returns>
 public PostbackInfo GetPostbackInfo(string registrationId)
 {
     ServiceRequest request = new ServiceRequest(configuration);
       request.Parameters.Add("regid", registrationId);
       XmlDocument response = request.CallService("rustici.registration.getPostbackInfo");
       XmlElement postbackInfoElem = ((XmlElement)response.GetElementsByTagName("postbackinfo")[0]);
       return new PostbackInfo(postbackInfoElem);
 }
        /// <summary>
        /// Gets the url to directly launch/view the course registration in a browser
        /// </summary>
        /// <param name="registrationId">Unique Identifier for the registration</param>
        /// <param name="redirectOnExitUrl">Upon exit, the url that the SCORM player will redirect to</param>
        /// <returns>URL to launch</returns>
        /// <param name="debugLogPointerUrl">Url that the server will postback a "pointer" url regarding
        /// a saved debug log that resides on s3</param>
        public string GetLaunchUrl(string registrationId, string redirectOnExitUrl, string cssUrl, string debugLogPointerUrl)
        {
            ServiceRequest request = new ServiceRequest(configuration);
              request.Parameters.Add("regid", registrationId);
              if (!String.IsNullOrEmpty(redirectOnExitUrl))
            request.Parameters.Add("redirecturl", redirectOnExitUrl);
              if (!String.IsNullOrEmpty(cssUrl))
            request.Parameters.Add("cssurl", cssUrl);
              if (!String.IsNullOrEmpty(debugLogPointerUrl))
            request.Parameters.Add("saveDebugLogPointerUrl", debugLogPointerUrl);

              return request.ConstructUrl("rustici.registration.launch");
        }
 /// <summary>
 /// Get the full launch information for the launch with the given launch id
 /// </summary>
 /// <param name="launchId"></param>
 /// <returns></returns>
 public LaunchInfo GetLaunchInfo(string launchId)
 {
     ServiceRequest request = new ServiceRequest(configuration);
       request.Parameters.Add("launchid", launchId);
       XmlDocument response = request.CallService("rustici.registration.getLaunchInfo");
       XmlElement launchInfoElem = ((XmlElement)response.GetElementsByTagName("launch")[0]);
       return new LaunchInfo(launchInfoElem);
 }
        //TODO: Other overloads of createRegistration....

        /// <summary>
        /// Create a new Registration (Instance of a user taking a course).
        /// This particular overload is intended to support all possible input values with
        /// some sensible default values for less commonly used parameters.
        /// </summary>
        /// <param name="registrationId">Unique Identifier for the registration</param>
        /// <param name="courseId">Unique Identifier for the course</param>
        /// <param name="learnerId">Unique Identifier for the learner</param>
        /// <param name="learnerFirstName">Learner's first name</param>
        /// <param name="learnerLastName">Learner's last name</param>
        /// <param name="resultsPostbackUrl">URL to which the server will post results back to</param>
        /// <param name="authType">Type of Authentication used at results postback time</param>
        /// <param name="postBackLoginName">If postback authentication is used, the logon name</param>
        /// <param name="postBackLoginPassword">If postback authentication is used, the password</param>
        /// <param name="resultsFormat">The Format of the results XML sent to the postback URL</param>
        /// <param name="email">Learner's email</param>
        /// <param name="versionId">Optional versionID, if Int32.MinValue, latest course version is used.</param>
        /// <param name="learnerTags">A comma separated list of learner tags to associate with this registration</param>
        /// <param name="courseTags">A comma separated list of course tags to associate with this registration</param>
        /// <param name="registrationTags">A comma separated list of tags to associate with this registration</param>
        public void CreateRegistration(
            string registrationId,
            string courseId,
            string learnerId,
            string learnerFirstName,
            string learnerLastName,
            string resultsPostbackUrl,
            RegistrationResultsAuthType authType    = RegistrationResultsAuthType.FORM,
            string postBackLoginName                = "",
            string postBackLoginPassword            = "",
            RegistrationResultsFormat resultsFormat = RegistrationResultsFormat.COURSE,
            string email            = "",
            int versionId           = Int32.MinValue,
            string learnerTags      = "",
            string courseTags       = "",
            string registrationTags = "")
        {
            ServiceRequest request = new ServiceRequest(configuration);

            // Required:
            request.Parameters.Add("regid", registrationId);
            request.Parameters.Add("courseid", courseId);
            request.Parameters.Add("learnerid", learnerId);
            request.Parameters.Add("fname", learnerFirstName);
            request.Parameters.Add("lname", learnerLastName);

            // Optional:

            if (!String.IsNullOrEmpty(resultsPostbackUrl))
            {
                request.Parameters.Add("postbackurl", resultsPostbackUrl);
                request.Parameters.Add("authtype", Enum.GetName(authType.GetType(), authType).ToLower());
            }
            if (!String.IsNullOrEmpty(postBackLoginName))
            {
                request.Parameters.Add("urlname", postBackLoginName);
            }
            if (!String.IsNullOrEmpty(postBackLoginPassword))
            {
                request.Parameters.Add("urlpass", postBackLoginPassword);
            }

            request.Parameters.Add("resultsformat", Enum.GetName(resultsFormat.GetType(), resultsFormat).ToLower());

            if (!String.IsNullOrEmpty(email))
            {
                request.Parameters.Add("email", email);
            }
            if (versionId != Int32.MinValue)
            {
                request.Parameters.Add("versionid", versionId);
            }

            // Optional tags
            if (!String.IsNullOrEmpty(learnerTags))
            {
                request.Parameters.Add("learnerTags", learnerTags);
            }
            if (!String.IsNullOrEmpty(courseTags))
            {
                request.Parameters.Add("courseTags", courseTags);
            }
            if (!String.IsNullOrEmpty(registrationTags))
            {
                request.Parameters.Add("registrationTags", registrationTags);
            }

            request.CallService("rustici.registration.createRegistration");
        }
        /// <summary>
        /// Get the status of any asynchronous jobs for sending private emails for an invite
        /// </summary>
        /// <param name="invitationId">invitation id of invite in question</param>
        /// <returns>job status value</returns>
        public String GetInvitationStatus(string invitationId) 
        {
		    ServiceRequest request = new ServiceRequest(configuration);
            request.Parameters.Add("invitationId", invitationId);
            
            XmlDocument response = request.CallService("rustici.invitation.getInvitationStatus");
            return response.DocumentElement.InnerText;
		
        }
        /// <summary>
        /// Returns the current state of the registration, including completion
        /// and satisfaction type data.  Amount of detail depends on format parameter.
        /// </summary>
        /// <param name="registrationId">Unique Identifier for the registration</param>
        /// <param name="resultsFormat">Degree of detail to return</param>
        /// <returns>Registration data in XML Format</returns>
        public string GetRegistrationResult(string registrationId, RegistrationResultsFormat resultsFormat, DataFormat dataFormat)
        {
            ServiceRequest request = new ServiceRequest(configuration);
              request.Parameters.Add("regid", registrationId);
              request.Parameters.Add("resultsformat", Enum.GetName(resultsFormat.GetType(), resultsFormat).ToLower());
              if (dataFormat == DataFormat.JSON)
            request.Parameters.Add("dataformat", "json");
              XmlDocument response = request.CallService("rustici.registration.getRegistrationResult");

              // Return the subset of the xml starting with the top <summary>
              return response.ChildNodes[1].InnerXml;
        }
    	/// <summary>
    	/// Get a list of invitations that meet the filtering criteria.  no filtering will return all
    	/// </summary>
    	/// <param name="invFilter">filter for the invitation id</param>
    	/// <param name="coursefilter">filter for the courseId</param>
    	/// <returns>a list of InvitationInfo objects</returns>
	    public List<InvitationInfo> GetInvitationList(String invFilter, String coursefilter)
        {
		    ServiceRequest request = new ServiceRequest(configuration);
		    if (invFilter != null) {
                request.Parameters.Add("filter", invFilter);
            }
            if (coursefilter != null) {
                request.Parameters.Add("coursefilter", coursefilter);
            }

            XmlDocument response = request.CallService("rustici.invitation.getInvitationList");
            return InvitationInfo.parseListFromXml(response);
        }
 /// <summary>
 /// Return a registration summary object for the given registration
 /// </summary>
 /// <param name="registrationId">The unique identifier of the registration</param>
 /// <returns></returns>
 public RegistrationSummary GetRegistrationSummary(string registrationId)
 {
     ServiceRequest request = new ServiceRequest(configuration);
       request.Parameters.Add("regid", registrationId);
       request.Parameters.Add("resultsformat", "course");
       request.Parameters.Add("dataformat", "xml");
       XmlDocument response = request.CallService("rustici.registration.getRegistrationResult");
       XmlElement reportElem = (XmlElement)response.GetElementsByTagName("registrationreport")[0];
       return new RegistrationSummary(reportElem);
 }
        // <summary>
        /// Confirm that a registrationExists
        /// </summary>
        /// <param name="registrationId">Unique Identifier for the registration</param>
        public bool RegistrationExists(string registrationId)
        {
            ServiceRequest request = new ServiceRequest(configuration);
              request.Parameters.Add("regid", registrationId);
              XmlDocument response = request.CallService("rustici.registration.exists");

              XmlElement attrEl = (XmlElement)response.GetElementsByTagName("result")[0];

              return Convert.ToBoolean(attrEl.InnerXml.ToString());
        }
        public void getAccountInfo()
        {
            ServiceRequest req = new ServiceRequest(cfg);

            Console.WriteLine(req.CallService("rustici.reporting.getAccountInfo").OuterXml);
        }