简体   繁体   English

如何从 SAP Gateway 中的数据提供程序类获取会话 ID?

[英]How to get session id from data provider class in SAP Gateway?

I am trying to find out how could I get information about external session id?我想知道如何获取有关外部会话 ID 的信息? I see it on a very top of the abap stack:我在 abap 堆栈的最顶部看到它: 在此处输入图片说明

However, did not find any way to access this variable in the Data Provider Class.但是,在Data Provider Class 中没有找到任何方法来访问这个变量。 Do you have any tipp?你有什么tipp吗?

The session_id is actually a static attribute specified in the IF_HTTP_SERVER interface. session_id 实际上是 IF_HTTP_SERVER 接口中指定的静态属性。 Because of the way in which ABAP sessions work, it is not possible to have two HTTP requests processed simultaneously in the same ABAP session, so I guess it makes sense to have the session_id as static.由于 ABAP 会话的工作方式,不可能在同一个 ABAP 会话中同时处理两个 HTTP 请求,所以我想将 session_id 设为静态是有意义的。

Anyway, you can do something like this in your DPC_EXT class to obtain the session:无论如何,您可以在 DPC_EXT 类中执行以下操作以获取会话:

DATA(lv_session) = cl_http_server=>if_http_server~session_id.

上面代码的结果

I had the same question and came to the same solution as Serban provided.我有同样的问题,并得出了与 Serban 提供的相同的解决方案。 However, I hoped that sending multiple requests from the same browser window would have the same session id -- what is my understanding of session ids BTW.但是,我希望从同一个浏览器窗口发送多个请求将具有相同的会话 ID——顺便说一句,我对会话 ID 的理解是什么。 Which does not seem to be the case: subsequent odata calls from the same browser window to the same service (actually the exactly same service calls) showed always different sessionids in the debugger.情况似乎并非如此:从同一浏览器窗口到同一服务的后续 odata 调用(实际上是完全相同的服务调用)在调试器中总是显示不同的 sessionid。 So I think the sessionid on abap side is not really useful.所以我认为 abap 端的 sessionid 并不是很有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM