Skip to main content

When I perform a Web Service Call to update a list item, is there any way I can capture a response that the update was successful?

Currently I have a bool called Data Transfer Received and after I send an Item Update I send a response back that makes that bool True, then I wait 5 minutes and check to ensure the bool was flipped. It just seems like there should be an easier way...

You can try to use ajax call:

var url = "http://MyWebService.asmx/MyRequest";

$.ajax({

data: jQuery.toJSON(data),

dataType: "json",

url: url,

type: "POST",

contentType: "application/json; charset=utf-8",

success: function (result) { alert("Success");},

error:function(result) { alert("Error");}

});

Let me know if this was useful for you!

Cheers,

Sukesh


I'm using the default SharePoint list service; lists.asmx > UpdateListItems.

I'm new to using web service calls and I think I just need to test out the response option and see what comes over after a call. Sometimes you get so caught up in reaching the deadline that you don't stop to experiment and learn new things...

In the meantime I just had the receiving site (B) send an update that flipped a bool on the sending site (A), waited a minute on (A) and checked to see if it came over and then cleared the bool.


If you use the UpdateListItems method in Lists.asmx, you can store the result in its own text variable and include error handling for the action on the bottom of the action configuration. This is so you catch errors during the update as well as errors with the web service call.

The result text of UpdateListItems contains a detailed report for each update action performed, with its own error code and text. You can parse this text with the query xml action for errors and add the error handling depending on error codes.

The error handling of the web service call action itself on the bottom of the action configuration contains three fields - catch errors (should be on 'yes'), store the error occurance (map this to a bool variable) and the error message (map to a text variable). If an error occurrs during the web service, for example the server is unreachable or the request timed out, the bool variable will be true and you can add additional error handling accordingly after the web service call.

Hope that helps...


Reply