如何将C ++程序连接到WCF服务? [英] How to connect a C++ program to a WCF Service?

查看:106
本文介绍了如何将C ++程序连接到WCF服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我工作的地方有一些用C#编写的软件和一些用C ++编写的软件(最重要的)。前一段时间,我们决定通过在Web服务上发送堆栈跟踪和异常信息来跟踪软件中的任何可能的问题。所以我来了一个WCF服务,获取信息,并将它们存储在数据库和发送自动电子邮件。它的工作,我们必须通过密码,它的安全,但现在我想要我们的其他软件,用C ++编写的,使用这个webservice(这个软件是用于windows和linux,所以我们不能只是使对用户机器中另一个软件的调用)。

In the place I work there are some software written in C# and some written in C++ (the most important ones). Some time ago we decided it would be a good idea to track any possible problem in the software, by sending stack trace and exception information over a web service. So I came with a WCF Service, that gets the information and store them on a database and send an automatic e-mail. It worked, we had to secure it through password, it's done, but now I want our other software, the one written in C++, to use this webservice (this software is used both on windows and linux, so we can't just make a call to another software in the user machine).

我已经google了,它发现这个教程了解如何使用 gSOAP ,这到目前为止还没有帮助我(很多错误,它不是很详细,并且web.config文件是不可能读的)。我想知道是否有任何其他方式来实现这一点。此外,由于我在我的web服务使用身份验证,它现在有一个wsHttpBinding(aFAIK不支持 gSOAP )。

I've googled about it, and found this tutorial on how to use gSOAP, which so far didn't help me very much (lots of errors, it is not very detailed, and the web.config file is impossible to read). I was wondering if is there any other way to achieve this. In adition, since I'm using authentication on my webservice, it now has a wsHttpBinding (which AFAIK isn't supported by gSOAP).

你们能帮助我吗?

推荐答案

由于您的WCF服务是在C#与.NET,唯一的问题是让C ++应用程序能够谈其中一种方法是遵循 WCF的REST / SOAP端点中的建议服务和相关文章。

Since your WCF service is in C# with .NET, and the only issue is getting the C++ application to be able to talk to it, one way is to follow the advice in REST / SOAP Endpoints for a WCF service and related articles.

您的C#程序继续对您的服务具有完全的SOAP访问。
你的C ++程序可以做这样的REST访问:

Your C# programs continue to have the full SOAP access to your service. Your C++ programs could do something like this for REST access:


  • 浏览到服务命令的HTTP GET URL

这是一个非常小的改变,WCF服务提供SOAP和REST。
REST能力打开您对JavaScript以及C ++客户端的服务。

It is a pretty minimal change to your WCF service to offer both SOAP and REST. The REST ability opens your service to JavaScript as well as C++ clients.

您可能需要将接口限制为简单数据或类对象以C ++语法解析。

You may need to restrict the interface to simple data, or class objects that are easy to parse in C++.

这篇关于如何将C ++程序连接到WCF服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆