Ajay Gautam

Ajay Gautam

  • NA
  • 204
  • 0

How to capture the ToArray() value from webservice to aspx.cs

Jul 21 2010 4:30 PM

Hi All,

I have one function in webservice:-

/// <summary>
        /// Get the required user agreements for the application specified.
        /// </summary>
        /// <param name="applicationName">The name of the application.</param>
        /// <returns>A UserAgreement array containing the name and text of the user agreement.</returns>
        [WebMethod]
        public UserAgreement[] GetRequiredUserAgreements(string applicationName)
        {
            List<UserAgreement> userAgreements = new List<UserAgreement>();

            KeyValuePair<string, string>[] parameters = new KeyValuePair<string, string>[1];
            KeyValuePair<string, string> parameter = new KeyValuePair<string, string>("applicationName", applicationName);
            parameters[0] = parameter;
            int returncode = Keups.Business.WebServiceAudit.RecordWebServiceAccess("InquiryService",
                this.User.Identity.Name, "GetRequiredUserAgreements", parameters);
            if (returncode != 0)
            {
                return userAgreements.ToArray();
            }
            
            Keups.Business.Application application = Keups.Business.Application.FindApplicationByName(applicationName);
            if (application != null)
            {
                Keups.Business.UserAgreement[] agreements = application.Agreements;
                foreach (Keups.Business.UserAgreement agreement in agreements)
                {
                    UserAgreement userAgreement = new UserAgreement();
                    userAgreement.AgreementName = agreement.Name;
                    userAgreement.AgreementText = agreement.Text;
                    userAgreements.Add(userAgreement);
                }
            }

            return userAgreements.ToArray();
        }

i have already registered the webservice, now i need to capture the return value in my aspx.cs page.

i tried like this

UserAgreement[] userAppAgreements = inquiry.GetRequiredUserAgreements(appName);

this is giving me error.

then i tried like this

object  userAppAgreements = inquiry.GetRequiredUserAgreements(appName);

here not able to check the null and >0 condition.

Any help?



Answers (1)