如何将桌面应用程序公开为安全 Web 服务?
Window 桌面应用程序提供 C++ API,可提供一系列客户信息,例如姓名和地址。我想将其公开为具有安全性的 SOAP Web 服务,以便该 Web 服务的授权客户端(通过 ESB 从基于 Linux/Java 的远程服务器)可以在 SOA 实现(基于 Java)中随时获取此信息。 桌面应用程序没有标准数据库。它在内部存储数据。它基本上是旧的定制 CRM 应用程序,安装在每个代理的 PC 机上。每个代理商都有自己的客户名单。
实现这一任务需要采取哪些步骤?
我需要将其作为 Windows 服务运行吗?
The Window desktop application provides C++ API that gives an array of customer information such as name and address. I want to expose this as SOAP Web Service with Security so that authorized clients (from remote servers Linux/Java based through ESB) of this web service can get this information at any time they want in SOA implementation (Java based).
The desktop application does not have a standard database. It stores its data internally. Its basically old custom built CRM application that is installed on each agent's PC box. Each agent has its own list of customers.
What are the steps to achieve this task?
Do I need to run this as Windows service?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
简短的回答是,是的,您可以通过 SOAP Web 服务公开桌面应用程序中的数据。使用 C# 和 .NET 更容易实现,但使用 C++ 也并非不可能。您需要采取什么步骤取决于您正在为哪个平台进行开发。
大致 -
实现一个支持 SSL 的端点,客户端可以在其中连接到您的桌面应用程序(使用 C++ 中的套接字或使用 .NET 的 HTTPListener)。
编写可以接收和发送 SOAP 请求的代码。
处理 SOAP 请求并返回格式正确的 SOAP 响应。
处理 WSDL 请求。
实施安全机制(基于 cookie 或其他)。
使用.NET,大部分内容已经在平台代码中,您只需将各个部分组合在一起即可。使用 C++,您可能会找到一些第三方库,但本质上您将编写自己的库。
如果您希望在桌面用户未登录并运行桌面应用程序时数据可用,则只需实现 Windows 服务。这里的挑战是您必须确保 Windows 服务可以访问桌面应用程序正在使用的相同数据。
另一种策略是使用 C++ API 和 Interop 从桌面应用程序访问数据,并将 Web 服务实现为托管在 IIS 上的标准开箱即用 asmx。
The short answer is, yes, you can expose data from a desktop application through a SOAP web service. It is easier to do with C# and .NET, but not impossible to do from C++. What steps you need to take will depend on which platform you are developing for.
Roughly -
Implement an endpoint that supports SSL where clients can connect to your desktop application (using sockets in C++ or HTTPListener using .NET).
Write code that can receive and dispatch SOAP requests.
Handle SOAP requests and return properly formatted SOAP responses.
Handle WSDL requests.
Implement a security mechanism (cookie based or otherwise).
Using .NET, most of this is in the platform code already, you just have to put the pieces together. With C++, you may find some third party libraries but essentially you'll be writing your own.
You only need to implement a windows service if you want the data to be available while a desktop user is not logged in and running your desktop application. The challenge here is that you'll have to make sure the windows service can access the same data the desktop application is using.
Another strategy would be to access the data from your desktop application using the C++ API and Interop and implement the web service as a standard out of the box asmx hosted on IIS.