views:

13

answers:

1

i have a simple asmx page with one web method which return array of an object. My question was , whenever this method is called is it possible to know that the array of an object was returned successfully.

My asmx page

using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class ProcessServices : System.Web.Services.WebService
{
    public ProcessServices()
    {

        //Uncomment the following line if using designed components 
        //InitializeComponent(); 
    }

    [WebMethod]
    public Customer[] getData(string var, string var2)
    {
        try
        {
           Customer o = new Customer();
           return o.getDatatoSend(var,var2);
        }
        catch (Exception ex) 
        {
            throw ex; 
        }
    }
}

After the getData() web method is called and array of cutomer is returned i would i like to update my database after successful transfer.

So how can i determine if the array was returned successfully?

A: 

If you're asking if you can determine whether the client successfully received the data you sent, you can't. Once you return something from your method (and the data is in transit back to the consumer) the execution of your code is done.

Your only reliable option here is to create another service and rely on your consumers to call that service once they retrieve data from your original web service.

Justin Niessner