Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 229311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:45:19+00:00 2026-05-11T19:45:19+00:00

I have a web service with a method that has two string parameters. When

  • 0

I have a web service with a method that has two string parameters. When I’m debugging, I can see in my calling method where it passes two string values into the method, but actually the WebMethod just gets null for both values. Here is some code:

WebMethod

[WebMethod(Description = "Set username and password for validation purposes.")]
public void Login(string uname, string pword)
{
    username = uname;
    password = pword;
}

Calling Method

NewsletterEmailSubscribers nes = new NewsletterEmailSubscribers();
nes.Login("Username", "Password");

What am I doing wrong here?

–EDIT–

Adding more code.

The web service:

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
public class NewsletterEmailSubscribers : WebService
{
    private static string username, password;

    public NewsletterEmailSubscribers()
    {

    }


    /// <summary>
    /// Logins the specified username.
    /// </summary>
    /// <param name="username">The username.</param>
    /// <param name="password">The password.</param>
    [WebMethod(Description = "Set username and password for validation purposes.")]
    public void Login(string uname, string pword)
    {
        username = uname;
        password = pword;
    }

    /// <summary>
    /// Adds subscriber email account.
    /// </summary>
    /// <param name="emailAddress">The email address</param>
    /// <param name="newsletterType">The newsletter they have signed up to receive</param>
    /// <param name="validationCode">The validation code</param>
    [WebMethod(Description = "Initial add of subscriber email address and newsletter signing up for.")]

    public void AddSubscriber(
        string emailAddress,
        string newsletterType,
        string validationCode)
    {
        // Check some values
        //Authenticate user, will throw exception if the user is invalid

        using (SOAValidation validation = new SOAValidation())
        {
            validation.ValidateConnection(validationCode, username, password, "Full");
        }

        OracleParameterCollection parameters = new OracleParameterCollection();
        parameters.AddWithValue("subscriber_email", emailAddress);
        parameters.AddWithValue("newsletter_type", newsletterType);
        Database.ExecuteQuery("dw.newsletter_pkg.newsletter_subscriber_add", parameters);
    }
}

Webpage using the service (NewsletterEmailSubscribers)

private void SubmitEmail(string email)
{
    if (ValidateEmail(email))
    {
        try
        {
            NewsletterEmailSubscribers nes = new NewsletterEmailSubscribers();
            nes.Login("Username", "Password");
            string validationCode;
            using (Cokesbury.RemoteValidation.Validator validator = new Cokesbury.RemoteValidation.Validator())
            {
                validationCode = validator.ValidationCode(System.Configuration.ConfigurationManager.AppSettings["PasswordSalt"].ToString());
            }

            // submit to db
            nes.AddSubscriber(email, "FICT", validationCode);
            // Switch to confirm message
            mvPage.SetActiveView(vwThankYou);
        }
        catch (Exception ex)
        {
            mvPage.SetActiveView(vwFail);
            bool rethrow = ExceptionPolicy.HandleException(ex, "Presentation Services Exception Policy");
            if (rethrow)
            {
                throw (ex);
            }
        }
    }
    else
        lblEmailError.Visible = true;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T19:45:19+00:00Added an answer on May 11, 2026 at 7:45 pm

    Did you create this webservice then hook it up to your other code, or have you designed the webservice to use the same interface as another?

    I did the latter once and changed the capitalisation of the parameters in the WebMethod, which lead to me receiving null instead of the correct values.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 122k
  • Answers 122k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer First, you could check out the Ribbon Preview in the… May 12, 2026 at 12:42 am
  • Editorial Team
    Editorial Team added an answer You need to prevent the default action in your label… May 12, 2026 at 12:42 am
  • Editorial Team
    Editorial Team added an answer It seems that this is feature/bug in VS 2003. Assembly… May 12, 2026 at 12:42 am

Related Questions

I have the following class in Class Library: Artist , which is a POCO
I've come across a design pattern that's been referred to as a Handler Pattern,
I have a simple web service that uses an oracle database. When I test
I have a WCF Service and an application with a Service Reference to it,

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.