How to connect a C ++ program to a WCF service?

In the place where I work, there is some software written in C #, and some written in C ++ (the most important). Some time ago, we decided that it would be nice to track any possible problem in the software by sending stack statistics and exception information via a web service. So I came up with a WCF service that receives information and stores it in a database and sends an automatic email. It worked, we had to provide it with a password, it was done, but now I want our other software written in C ++ to use this web service (this software is used for both windows and Linux therefore we cannot just make a call of other software on the user's machine).

I looked for this information and found this tutorial on how to use gSOAP , which so far has not really helped me (many errors, it is not very detailed, and the web.config file cannot be read). I was wondering if there is another way to achieve this. In addition, since I use authentication in my web service, it now has wsHttpBinding (which AFAIK is not supported by gSOAP ).

Can you guys help me?

+7
source share
2 answers

Since your WCF service is in C # with .NET, and the only problem is getting the C ++ application to talk to it, one way is to follow the recommendations in REST / SOAP for the WCF service and related articles.

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

  • See the HTTP GET URL for the required service command.
  • Then pick up (or analyze and use) any answer.

This is a pretty minimal change for your WCF service offering both SOAP and REST. The REST function opens your service for JavaScript, as well as for C ++ clients.

You may need to limit the interface to simple information or class objects that are easy to parse in C ++.

+5
source

Will the .NET Framework be installed on computers running C ++ applications?

Check out: Create a WCF service for C ++ unmanaged clients

+1
source

All Articles