0

I'm trying to match selected year in ComboBox dropdown list with national holidays in Ireland, so when the user click on, e.g. 2010, he gets the list of holidays along with their corresponding dates in the TextBox1.

Looking at the proxy class available, I see there is a function called GetHolidaysForYear, which takes two parameters: year and CountryCode and returns the list of holidays in the form of an array. However, the array is empty. I don't understand why?

  [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://www.holidaywebservice.com/HolidayService_v2/GetHolidaysForYear", RequestNamespace="http://www.holidaywebservice.com/HolidayService_v2/", ResponseNamespace="http://www.holidaywebservice.com/HolidayService_v2/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public Holiday[] GetHolidaysForYear(Country countryCode, int year) {
    object[] results = this.Invoke("GetHolidaysForYear", new object[] {
                countryCode,
                year});
    return ((Holiday[])(results[0]));
}

Can I use the calling function in my handler for the "Find Holidays" button on my interface?

Here is the code for the GUI:

namespace GUI
{
    public partial class Form1 : Form
    {
        int year;
        HolidayService2 myHolidayClass = new HolidayService2();

        public Form1()
        {
            InitializeComponent();
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
           //When pressed, the list of holidays should be displayed in the TextBox1     
        }


        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }
    }
}

So the question is - how to pass the country code and a year? Surely the year is selected from the ComboBox, no? I managed to display the year in the textbox, when clicked in the dropdown menu, but that was just me babystepping into xml/c# coding. Any help will be appreciated!

I've reviewed the following threads already:

...but none seem to be answering my question. Thanks in advance!

Community
  • 1
  • 1
escapadro
  • 1
  • 1
  • Some questions: 1) What are you referring to when you say "the calling function"? 2) Somebody wrote `GetHolidaysForYear()`. Did he document it? When a function doesn't do what you expect, you need to find out *what it expects for parameters*, and you need to find out exactly (very, very exactly) *what you actually gave it*. We have neither piece of information. In effect, if we don't know exactly what you did, how can we guess exactly what was wrong with what you did? – 15ee8f99-57ff-4f92-890c-b56153 Mar 01 '17 at 18:50
  • GetHolidaysForYear is a function within the proxy class, which, from my understanding is capable of taking two parameters (year and the countrycode) and returning the corresponding national holidays. I am unsure about the passing of parameters, though. – escapadro Mar 01 '17 at 18:51
  • So the proxy class is a proxy for a webservice somewhere. Who wrote the webservice? What actual values are you passing it for country code and year? Why won't you show me the actual code where you tried calling `GetHolidaysForYear()`? That's where the problem is: You called it and it didn't give you any results. That's the whole reason you're here. Yet you show us every line of code EXCEPT the one line that didn't work. Does that make sense to you? – 15ee8f99-57ff-4f92-890c-b56153 Mar 01 '17 at 18:54
  • 1
    It does now! Well, I'm gonna have to go back to college and access my drive to show you the code. In the meantime, I'll try to work on it at home, but I understand what you're saying. I'll be back with the code soon! – escapadro Mar 01 '17 at 19:01
  • Thanks. Just @ me when you've got it. – 15ee8f99-57ff-4f92-890c-b56153 Mar 01 '17 at 19:02
  • @EdPlunkett I worked it out in the end. Thank you, the issue was the parameters sent to the SOAP service! – escapadro Apr 20 '17 at 14:21

0 Answers0