cancel
Showing results for 
Search instead for 
Did you mean: 

SOAP Connection vs RFC Connection

Former Member
0 Kudos

I'm developing a .Net Connector Proxy for two BW BAPIs :

<b>BAPI_MDPROVIDER_GET_KEY_DATE</b> and <b>BAPI_MDPROVIDER_SET_KEY_DATE</b> in order to manage the key date for some MDX queries on the same BW System. When I use the RFC Connection for my proxy, all is Ok and I'm able to set and retrive the new Key Date, but when I try to use the SOAP Connection it doesn't work (no SAP Session between the 2 calls ?).

The code is

BAPIRET2 ret= new BAPIRET2();

string kd;

sapProxy11.Bapi_Mdprovider_Set_Key_Date("20020101", out ret);

sapProxy11.Bapi_Mdprovider_Get_Key_Date(out kd, out ret);

MessageBox.Show(kd);

Accepted Solutions (1)

Accepted Solutions (1)

reiner_hille-doering
Active Contributor
0 Kudos

Hm, this is interesting. Some notes about sessions in Soap: As Soap itself is stateless and connectionless, everybody invents its own trick to simulate a session.

The Soap processor uses some cookies in conjunction with the query string parameter "session_mode":

The first call must have a "session_mode=1", subsequent calls have no "session_mode" and the last call must have "session_mode=2".

The SoapConnection handles this automatically.

However, even this may fail if e.g. the WebService client doesn't accept cookies.

I recommend to use a network sniffer to see what happens on the line, e.g.

- is the TCP connection reused or closed?

- Are cookies passed back to .net and correctly again passed in on the next call?

- Is the "session_mode" parameter correcly appended?

Former Member
0 Kudos

Hi, just to integrate my first topic; we switch to TRUE the UseSoap flag of the .Net Connector SAPLogonDestination object. All the remaining code is unchanged. I ignore how the SAPLogonDestination implements the SOAP Session. Moreover I need to maintain the SAP Session in order to set correctly the KEYDATE for the BW Reports and Hierarchies time dependent. I would like to use XMLA WebService and DISCOVER method to read a Hierarchy, but I cannot set correctly the KEYDATE in the method. All our issue generates from this requirement.

reiner_hille-doering
Active Contributor
0 Kudos

Sure, I understood this. I just explained you some of the details so you have a change to diagnostic the problems.

Former Member
0 Kudos

I tried this and it works !

// enable Cookies in the SOAP Client ...

kd.CookieContainer = new CookieContainer();

// activate session mode first time ...

string orgUrl = kd.Url;

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

string a = kd.BAPI_MDPROVIDER_GET_KEY_DATE(out ret);

// the result is today: in form yyyy-mm-dd (2006-05-02)

MessageBox.Show(a);

kd.Url = orgUrl;

ret = kd.BAPI_MDPROVIDER_SET_KEY_DATE("2005-03-02");

// session mode last invoke

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

a = kd.BAPI_MDPROVIDER_GET_KEY_DATE(out ret);

MessageBox.Show(a);

// the result has been changed (2005-03-02)

Now my issue is how to merge and create an unique Web Service Proxy (C#) sharing the session for

http://<SAP system>:<port>/sap/bw/xml/soap/xmla

and

http://<SAP system>:<port>//sap/bc/soap/wsdl11?services=BAPI_MDPROVIDER_SET_KEY_DATE,BAPI_MDPROVIDER_GET_KEY_DATE

Any ideas ?

Message was edited by: Nazareno Martinolli

Message was edited by: Nazareno Martinolli

reiner_hille-doering
Active Contributor
0 Kudos

This depends if you want to use .NET Connector (in Soap mode) or pure WebService proxies:

1. With NCo: Compose your proxy from all needes BAPIs using the proxy designer. In NCo you don't need to sepcify "session_mode", but you may need to enable the CookieContainer.

2. Without NCo: You need to get a WSDL with all needed functions in one. As long as they are BAPIs exposed by the SoapProcessor, that's simple. Else you many need to merge two WSDLs by hand. At runtime you need to change the URL at the adaquate moment. I don't have a better idea.

reiner_hille-doering
Active Contributor
0 Kudos

It could also work that you have actually 2 WebService proxies, but share the CookieContainer:

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.FirstCall();
proxy1.Url = orgUrl;
proxy2.SecondCall();
proxy1.Url = orgUrl + "?session_mode=2";
proxy2.LastCall();

Former Member
0 Kudos

Implementing your last post, it seems work correctly.

I have just to verify in production env. and on real data (time dependent hierarchies); but it's an other issue ...

well done Reiner !

Former Member
0 Kudos

Hi

Nazareno Martinolli

I'm trying to do the same thing as u using the same code in this thread, 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 like is told in this thread (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...

Final 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

Answers (0)