简体   繁体   English

如何将桌面应用程序公开为安全Web服务?

[英]How to expose desktop application as a Secure Web Service?

The Window desktop application provides C++ API that gives an array of customer information such as name and address. Window桌面应用程序提供了C ++ API,该API提供了一系列客户信息,例如姓名和地址。 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). 我想将其公开为具有安全性的SOAP Web服务,以便该Web服务的授权客户端(从远程服务器Linux / Java通过ESB)可以随时在SOA实现(基于Java)中获取此信息。 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. 它基本上是旧的定制CRM应用程序,安装在每个代理的PC盒上。 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? 我需要将其作为Windows服务运行吗?

The short answer is, yes, you can expose data from a desktop application through a SOAP web service. 简短的答案是,是的,您可以通过SOAP Web服务公开来自桌面应用程序的数据。 It is easier to do with C# and .NET, but not impossible to do from C++. 使用C#和.NET更容易,但使用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). 实现支持SSL的端点,客户端可以在该端点上连接到您的桌面应用程序(使用C ++中的套接字或使用.NET的HTTPListener)。

Write code that can receive and dispatch SOAP requests. 编写可以接收和调度SOAP请求的代码。

Handle SOAP requests and return properly formatted SOAP responses. 处理SOAP请求并返回格式正确的SOAP响应。

Handle WSDL requests. 处理WSDL请求。

Implement a security mechanism (cookie based or otherwise). 实施安全机制(基于cookie或其他方式)。

Using .NET, most of this is in the platform code already, you just have to put the pieces together. 使用.NET,大部分已经在平台代码中了,您只需要将各个部分放在一起。 With C++, you may find some third party libraries but essentially you'll be writing your own. 使用C ++,您可能会找到一些第三方库,但实际上您将编写自己的库。

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. 仅当希望在桌面用户未登录并运行桌面应用程序时数据可用时,才需要实现Windows服务。 The challenge here is that you'll have to make sure the windows service can access the same data the desktop application is using. 这里的挑战是,您必须确保Windows服务可以访问桌面应用程序正在使用的相同数据。

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. 另一种策略是使用C ++ API和Interop从桌面应用程序访问数据,并将Web服务作为IIS上托管的现成的asmx标准实现。

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

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