locked
issue in getting response from wsdl webservice.. RRS feed

  • Question

  •    Issue in getting response from wsdl  webservice:
       using: windows phone 7 silverlight c#:
       Get value from webservice and stored it in array and then have to pass the value to web service one by one using for loop.

       EX:

         for(int i=0;i<2;i++)
         {
          //getting peopleid from array
           get_peopleid= coll_peopleid_arr[i];

          //passing people id to mypeople_service
            people_client.mypeopleCollAsync(get_peopleid);
              // need some other way to get response in the loop itself.
            people_client.mypeopleCollCompleted += (sender, e) =>people_client_mypeopleCollCompleted(sender, e);

         }
         void people_client_mypeopleCollCompleted(objectsender,mypeopleservice.mypeopleCollCompletedEventArgs e)
         {
        //getting response here from
        e.results;
         }

    in doing so, getting response correctly but the response function(people_client_mypeopleCollCompleted) return value 2 times for every single id..  and having 3 method like this.this may cause delay..


    Solution Required:

    need to get response in the for loop itself. it will give better solution.
    i tried many solution none suites the requirement.



    thanks in advance..
    Monday, July 30, 2012 1:52 PM

All replies

  • Hi,

    Each time the following line is executed :-

    people_client.mypeopleCollCompleted += (sender, e) =>people_client_mypeopleCollCompleted(sender, e);

    An event handler is added. As this code is inside your for loop then this event handler will get called twice.

    If you are trying to get the response for two people at once then you will need to change your web method to support multiple people ids. At the moment your method can only ever return a single response for a single people id.

    Hope this helps.

    Paul Diston


    http://www.smartmobiledevice.co.uk

    Tuesday, September 4, 2012 10:02 AM