I am working with a windows app form where I want a button to call a web service, MakeANote.
The web service requires information which is returned with the login along with a ticket.
the LogOn call has some input parameters, 1 ref (which i heard is both input and output), and some output parameters. BUT it also RETURNS an array of “Information”. This array is put into my variable, pubinfo as follows:
Webservice.Information[] pubinfo = null; //initialize
pubinfo = myflo.LogOn(username, password, ref ticket, out settings, out users,out terms, out currentUser);
so the type is a custom type: Webservice.Information[]. Each Information element in the array has 3 properties: string ID, string Name, and boolean ReversedRead.
I was thinking that —as this is filled in with the LogOn button and therefore encapsulated within the method calling it and —- as i wanted to pass this info to the other web service, MakeANote, that I might do something like this:
for (int i = 0; i < pubinfo.Length; i++)
{
objInfo = pubinfo[i];
storePubInfo(objInfo);
MessageBox.Show("PubInfo stored", "PubInfo");
}
and store the pubinfo array in another function which the MakeANote function will have to call to collect it separately. This seems very messy to me, but I also want to keep things simple as I’m new to this all.
How would the storing function look like? Something as simple as this doesn’t seem to work.
public void storePubInfo()
{
return storePubInfo;
}
I’m fine with appending it as well. Is that better? And is returning alright or do i actually have to have something like Webservice.Information storePubInfo(var)
When I click the button, my function to make a note is called with the argument of the ticket.. so the ticket gets passed without a problem. My question is the array that’s being RETURNED with the logon, pubinfo.
I’m open for ideas if I’m trying to do this the wrong way, or there is a better way of doing this.
*Should I do something utterly different and perform the extraction in the buttonclick? Any good examples if so?
1 Answer