I've managed to write a service that returns an array in XML when tested by itself with no problems, but when I try and get my webpage to consume it I'm having difficulties
Here's my service simplified:
The consuming page has had countless versions of this:
I've tried so many combinations and Googled everywhere but I just can't seem to get it to work :(
I'm quite new at this so if anyone has any ideas I'd really appreciate it!
Here's my service simplified:
Code:
public struct ListData
{public string id, title, subtitle;}
[WebMethod]
public ListData[] GetListData()
{
int x = 0;
int number = 0;
ListData[] List = null;
List = new ListData[5];
while (x < 5)
{
List[x].id = "subtitle test" + System.Convert.ToString(x);
List[x].title = "subtitle test" + System.Convert.ToString(x);
List[x].subtitle = "subtitle test" + System.Convert.ToString(x);
x++;
}
Return List;
}
The consuming page has had countless versions of this:
Code:
localhost.Service myws = new localhost.Service();
localhost.ListData list = new localhost.ListData();
list = myws.GetListData();
Label1.Text = "Test data: <br/> " + list[0].Title + list[1].Subtitle + list[2].id;
I'm quite new at this so if anyone has any ideas I'd really appreciate it!
Comment