0

是否可以创建一个 Web 服务,包括一个执行某些操作然后期望返回值/操作来提交这些操作的方法?

我需要一个返回一些值的方法。在返回这些值的过程中,需要插入一些数据。收到这些返回值后,我需要确保我能够处理它们,然后提交初始方法。

如果该方法没有收到标志/提交/无论如何,插入将回滚。

这可能吗?(如果措辞不清楚,请见谅,希望我不够稳定)

我这样做是因为我需要获取一组数据,即使用常规 SQL 返回的速度很慢。我计划在服务器上压缩该(格式化的)数据(使用 Web 服务),并让该方法以压缩的二进制类型将其返回给我。如果在获取或处理该压缩二进制文件时出现问题,我需要能够回滚整个过程。

4

3 回答 3

1

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.

  1. 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.

  2. Call for commit based on the first call result and put transaction over here for saving data.

于 2012-09-29T18:27:42.753 回答
0

我认为您需要两个网络服务(如果我正确理解您的问题)。第一个执行操作并返回一个值。如果调用程序验证了返回值,它会调用第二个 Web 服务来执行提交。说得通?

于 2012-09-29T18:28:50.593 回答
0

我认为解决方案应该是这样的。

Method 1 - Create record and return the uid of it. Insert record in pending state
 Method 2 - Take parameter of created record and operation (approve or reject). Change the state of the record entered in method1.
于 2012-09-29T18:33:18.673 回答