cancel
Showing results for 
Search instead for 
Did you mean: 

Commit actions using webservice calls

Former Member
0 Kudos

Hi

I'm trying to call a webservice for some business operation and another webservice call to a bapi_commit, but I get no result; no commit is done.

I will try to explain the steps I took:

1 - I've created a webservice in ABAP, using se80, based on a BAPI.

2 - Because it was based on BAPI It generated a WSLD with all methods from the BO (business object) and the additional commit and rollback method that I choose to add.

3- The WSDL generated includes all methods (some business method + bapi_commit method).

4- I've also enabled the "session-oriented" feature to the webservice options

5- On the client side the proxy is generated and the methods invoked like this:

CookieContainer cookies = new CookieContainer();

WSProxy1 proxy1 = new WSProxy1();

WSProxy2 proxy2 = new WSProxy2();

proxy1.CookieContainer = cookies;

proxy2.CookieContainer = cookies;

string orgUrl = proxy1.Url;

proxy1.Url = orgUrl + "?session_mode=1";

proxy1.FirstBapiCall();

proxy1.Url = orgUrl;

proxy1.Url = orgUrl + "?session_mode=2";

proxy2.BapiCommitCall();

6 - In Abap debug mode I could see that the call to bapi_commit mehtod is being done but no real commit is done ... probably the commit session/transaction id is not the same of the first call...

Questions:

am i doing something wrong in the client code?

Is any way to monitor the session ID?

How the two calls are correlated? I think is by some id in the cookie? If So how can I see this id information in the http post?

Please help!

Best Regards

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi João,

check out the following SAP Note 1050075 - Adaptation of the cookie setting for stateful communication (https://service.sap.com/sap/support/notes/1050075). You need to install the patch in order to enable stateful Web Service communication between the .NET application and SAP Web Application server 6.40. Let me know when it works.

Thanks,

- Juergen

Former Member
0 Kudos

Thank you Juergen,

Do you know if is also necessary to do any additional configuration in the ICF to support stateful sessions?

Best Regards,

Joao

Former Member
0 Kudos

Hi João,

on ICF side there is no additional configuration necessary. After publishing the Web Service you should be able to call it in a stateful way. You just have to make sure that you have set the Web Service to stateful in SE 80 and that the Web Service is published. Here is a code snippet which uses the ExchangeRateCreate and an external commit:

CookieContainer cookie = new CookieContainer();

z_Create_ExchangeRatesService.z_Create_ExchangeRatesService _proxy

= new z_Create_ExchangeRatesService.z_Create_ExchangeRatesService();

_proxy.Credentials = new NetworkCredential("jdaiberl", "jdaiberl");

_proxy.CookieContainer = cookie;

_proxy.ExchangeRateCreate("X", "000", newData, "X", out strRateTypeOut, out bapiReturn, out strCurrTo);

_proxy.BapiServiceTransactionCommit("");

Thanks,

- Juergen