Is it possible to create a web service including a method that performs some operations and then expects a return value/action to commit those operations?
I need a method that returns some values. In the process of returning those values, some data needs to be inserted. After receiving those return values i need to make sure i am able to process them and then commit the initial method.
If the method doesn’t receive the flag/commit/whatever, the inserts are rolled back.
Is this possible?
(Sorry if the wording is not clear, hope I’m understable)
I am doing this because i need to get a set of data, that is to slow to be returned with regular SQL. I am planning on zipping that (formatted) data on the server (using a web service), and have the method return it to me in a zipped binary type. If something goes wrong in getting or processing that zipped binary, i need to be able to rollback the entire process.
To accomplish a commit on web service end after receiving web service response with single web service call is not possible, I am afraid. Http web services are stateless, you can make it stateful using sessions. You can make two services one for receiving response and other for performing commit. Between these two calls you can use session if they can help.
Call to receives set of values. You may set a session for next call timeout e.g. You should not start transaction in first call. Just return results. If your results are as per requirement of commit the save data with transaction. You can have some flag in DB records indicating the incomplete transaction in first call and commit or delete it second call and set flag accordingly.
Call for commit based on the first call result and put transaction over here for saving data.