C
Colin Basterfield
Hi,
I am trying to return an ArrayList from a Web Service:
public ArrayList GetYearList()
{
int RangeStart =
Int32.Parse(ConfigurationSettings.AppSettings["YearRangeStart"]);
int RangeEnd =
Int32.Parse(ConfigurationSettings.AppSettings["YearRangeEnd"]);
ArrayList yearList = new ArrayList();
for (int i = RangeStart; i <= RangeEnd; i++)
yearList.Add(i);
return yearList;
}
When I generate the Proxy however I find that in the Proxy code it is
returning
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("<urlname>/GetYea
rList", RequestNamespace="urlname>", ResponseNamespace="urlname>",
Use=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public object[] GetYearList() {
object[] results = this.Invoke("GetYearList", new object[0]);
return ((object[])(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginGetYearList(System.AsyncCallback callback,
object asyncState) {
return this.BeginInvoke("GetYearList", new object[0], callback, asyncState);
}
/// <remarks/>
public object[] EndGetYearList(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((object[])(results[0]));
}
So how can I turn this into an ArrayList at the 'receiving end', I tried
casting it to an ArrayList, but it say that it can't cast from an object to
an ArrayList...
Any ideas on this one please?
Many thanks
Colin B
I am trying to return an ArrayList from a Web Service:
public ArrayList GetYearList()
{
int RangeStart =
Int32.Parse(ConfigurationSettings.AppSettings["YearRangeStart"]);
int RangeEnd =
Int32.Parse(ConfigurationSettings.AppSettings["YearRangeEnd"]);
ArrayList yearList = new ArrayList();
for (int i = RangeStart; i <= RangeEnd; i++)
yearList.Add(i);
return yearList;
}
When I generate the Proxy however I find that in the Proxy code it is
returning
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("<urlname>/GetYea
rList", RequestNamespace="urlname>", ResponseNamespace="urlname>",
Use=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public object[] GetYearList() {
object[] results = this.Invoke("GetYearList", new object[0]);
return ((object[])(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginGetYearList(System.AsyncCallback callback,
object asyncState) {
return this.BeginInvoke("GetYearList", new object[0], callback, asyncState);
}
/// <remarks/>
public object[] EndGetYearList(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((object[])(results[0]));
}
So how can I turn this into an ArrayList at the 'receiving end', I tried
casting it to an ArrayList, but it say that it can't cast from an object to
an ArrayList...
Any ideas on this one please?
Many thanks
Colin B