Strange behaviour in WS-Proxy generation

Discussion in 'ASP .Net Web Services' started by Colin Basterfield, Dec 18, 2003.

  1. 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
     
    Colin Basterfield, Dec 18, 2003
    #1
    1. Advertising

  2. 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" <> wrote in message
    news:...
    > 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
    >
    >
    >
    >
     
    Colin Basterfield, Dec 18, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Marty McDonald

    BUG - web service proxy generation

    Marty McDonald, Aug 7, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    446
    Yan-Hong Huang[MSFT]
    Aug 11, 2003
  2. Replies:
    0
    Views:
    1,245
  3. Mark

    Web Service Proxy Generation

    Mark, Aug 6, 2004, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    114
  4. mtnmike

    WSE 1.0 proxy class generation

    mtnmike, Mar 2, 2005, in forum: ASP .Net Web Services
    Replies:
    2
    Views:
    180
    mtnmike
    Mar 2, 2005
  5. John W. Long

    HTML Generation (Next Generation CGI)

    John W. Long, Nov 22, 2003, in forum: Ruby
    Replies:
    4
    Views:
    372
    John W. Long
    Nov 24, 2003
Loading...

Share This Page