开发者

To determine if a asp.net web service's web method returned an array successfully

开发者 https://www.devze.com 2023-01-17 07:39 出处:网络
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 success

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
        {
           Cust开发者_如何学JAVAomer 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号