Strange behaviour in WS-Proxy generation

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
 
C

Colin Basterfield

This works,

object[] yearList = siteSummary.GetYearList();

ArrayList yearArrayList = new ArrayList(yearList);

for (int i = 0; i < yearArrayList.Count; i++)

ddlYear.Items.Add(yearArrayList.ToString());





Colin Basterfield said:
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( said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,705
Latest member
Stefkari24

Latest Threads

Top