Delphi 7 SOAP 身份验证和 SessionID 操作方法
我正在开发一个三层数据库应用程序。 1.) MS SQL 数据库 2.) 连接到数据库的中间层 SOAP 服务器(使用 Delphi 7) 3.)客户端(首先是win32 gui(使用Delphi 7) - 后来是其他平台)连接到SOAP服务器
我选择了一个SOAP服务器,以便在后期向各种客户端开放(而且一些win32 gui客户端将驻扎在国外) - 所以客户需要瘦)(这是鲍勃博士建议的)。
我是 SOAP 的新手,一直在研究有关身份验证的不同示例和论文。但我无法完全理解它。
我使用 Delphi 的 SOAP 服务器应用程序向导制作了 SOAP 服务器和客户端,并添加了 SOAP SERVER 数据模块、数据库连接以及一些数据集和提供程序。将客户端与 dbgrid 等连接起来,该部分工作正常。
但我希望客户端首先登录,然后能够访问数据,并且我希望服务器记录每个连接,以及当客户端注销或断开连接时,所以我猜测我需要 sessionID 和超时。我还希望服务器能够在任何给定时间告诉客户端还有谁“已连接”(或谁的会话仍然处于活动状态)。 我发现我需要创建一个身份验证标头,但无法弄清楚在哪里或谁可以获取 sessionID。我假设每次客户端连接到服务器时服务器都会生成一个sessionID?我如何得到这个?
任何帮助或建议/指示将不胜感激,
谢谢 贾斯汀
I am developing a 3 tier database application.
1.) MS SQL DB
2.) Middle tier SOAP Server (with Delphi 7) connected to the DB
3.) Clients (first win32 gui (with Delphi 7) - later other platfomrs) connected to the SOAP server
I chose a SOAP Server to be open to various clients at a later stage (also some of the win32 gui clients will be stationed abroad - so the clients need to be thin) (this as suggested by Dr. Bob).
I am new to SOAP and have been looking at different examples and papers about authentication. But cant quite get my head around it.
I have made a SOAP server and client with Delphi's SOAP Server Application Wizard and added a SOAP SERVER Data Module, added a database connection and some datasets and providers. Connected the client with dbgrid etc and that part works fine.
But I want the client first to login and then be able to access data and I want the server to log each connection and also when the client logs off or is disconnected, so I am guessing I need the sessionID and a timeout. I also want the server to be able to tell the clients who else is "connected" (or whos session is still active) at any given time.
I have gathered that I need to make a authentication header, but cant figure out where or who I can get a sessionID. I presume that each time a client connectes to the server the server generates a sessionID? How do I get this?
Any help or suggestions/pointer would be appreciated,
thanks
Justin
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
默认情况下,Soap 服务器不提供会话。您的服务器必须实现会话生命周期管理(登录/注销)等。
此处记录了基本解决方案:管理使用 Delphi 6 Web 服务进行会话
但请注意,这个解决方案还远非完美(请参阅注释),例如它不提供会话超时机制。
Soap servers do not provide sessions by default. Your server has to implement Session life cycle managment (Login / Logout) etc.
A basic solution is documented here: Managing sessions with Delphi 6 Web services
Note however that this solution is far from perfect (see comments), for example it does not provide a session timeout mechanism.
好的 - 想通了 - 我没有:
InvRegistry.RegisterHeaderClass(TypeInfo(IThorPayServerDB), TAuthHeader);
在初始化中
但我仍然无法弄清楚如何获取会话 ID - 或者某种独特的方式来了解哪个客户端会话已登录到服务器 - 有什么想法吗?
OK - figured it out - I had not:
InvRegistry.RegisterHeaderClass(TypeInfo(IThorPayServerDB), TAuthHeader);
in the initialization
But I still cant figure out how to get the session ID - or some unique way of know which client session is loged in to the server - any ideas?
Delphi XE 使用较新版本的 SOAP,也许这就是答案:
https://forums。 embarcadero.com/thread.jspa?messageID=200793
Delphi XE uses a newer version of SOAP, maybe that is the answer:
https://forums.embarcadero.com/thread.jspa?messageID=200793