What direction should I follow to add webservice functionalities to my application? - c++

I have a problem, and I know there are many ways to solve it. I hope you can help me chose the fittest.
I am developping an application mainly using Matlab, and I try to gradually shift some of its functionalities to c++. I develop on windows, for windows.
I am quite experienced in these two programming languages, but I know nothing of web development.
I want to add some functionalities to this application that will use some webservices hosted on a server protected by ssl.
I am alone on this project, but I can spend some time learning new stuff if need be.
I would like to know what tools you think I should better use for this task ?
So far, I have tried and failed the following approach :
calling the webservice directly from Matlab. I have added the self-signed ssl certificate to every truststore I could find on my computer, but I keep getting an error telling me that the certificate is not valid.
calling the webservice using gSoap and c++. For this, I need to rebuild the gSoap binaries with ssl capabilities. I tried too do so using visual studio and mingw/gcc but did not succeed, and I could not find any help online.
I have the feeling after a few hours/days browsing and looking for solution that the tools I try to use are not the most used and therefore not the best documented (and therefore not the best suited for a rookie), so what is your advice?

I think using gSoap from your C++ modules would be the best choice.
Information about using gSoap with SSL as client is available here: Secure SOAP Clients with HTTPS/SSL
A link about using gSoap for building a VS Application: Creating a gSoap eBay Client Application with Visual C++ 2008
May be this helps for using gSoap with MinGW: Using gSoap in Qt/Windows

Related

Windows client application using GSSAPI/Kerberos API to authenticate through KDC

Sorry for my question if it's obvious but I came from developing in the embedded world.
I m trying to develop a simple windows application in c/c++ to authenticate through KDC using either GSSAPI or Kerberos API directly. The assumption is the KDC and the server components are already in place. I think I understand how the whole process of authentication through Kerberos works between client, server and the KDC.
The problem is I don't know where to start to start using the GSSAPI or Kerberos API. I m using window 8 with visual studio 2013. Does windows SDK already pre-package with GSSAPI/Kerberos V5 API(maybe SSPI) for developer to start calling? I read on the web that application would need to go through SSPI to access the Kerberos API. Is that true? Seems like I can also download the Kerberos V5 SDK from MIT website but getting it to compile in windows is not simple.
I guess my question is what do I need to get start? I am struggling to see how all these different pieces fit together. Anyone who went through what I m going through or who can help is much appreciated.
Thanks
I came across the same problem and saw this Q unanswered if someone hasn't had much experience in this domain then it might makes sense to look at the following:
A basic client-server implemented using SSPI/GSS with detailed steps
on how to setup stuff.
The corresponding MSDN documentation to
wrap your head around the same piece of code.
A better description of how to map SSPI API's to GSS API's.
On *nix you mostly have to rely on GSSAPI, they are popular hopefully there will be a port for your environment.

Supporting Web Services from a Win/MFC/C++ App

I am looking for the best way to add support for a REST based Web Service to an MFC C++ Application. This is legacy code that has been around a long time.
I need to have the Application provide the Web Service. I've researched this, and the articles are about consuming Web Services in a C++ App. I envision having to monitor a port and respond to the HTTP requests. It would probably make more sense to tie in with WCF and IIS, but I am not sure how to move forward.
I already have a tool of "making" this App into a Windows Service. I realize it would be better to have a "real" app, and this is what I have to work with. There is so much logic in this code and we are limited in development time, so we are taking the fastest approach possible. We also cannot use DCOM, as the Web Service will be called by a Linux based system.
Any suggested articles would be much appreciated.
For C++ you can test two libraries WSF/C and gSoap, another alternative is to develop it with C# and WCF , and communicate between C# and C++ using C++\CLI.
I use the Poco Net c++ library for this as it supports both HTTP client and server functionality. I considered various other libraries including Boost based stuff, but other than Poco I struggled to find everything I needed in one tidy package. It also has some easy to use mutex support which became essential for me as soon as I added a web server front-end to what had previously been a simple single threaded console app. Poco is cross platform but I mainly use it windows and it has served me well to date. I'm not very clued up on MFC so I don't know how it would get on in that department though.

swig, soap or restful for my c/c++ library

I have a library/API that is completely built with C/C++ for over 10 years (under Linux). Now I want to export the API as a web service for other web projects use. I search for the web and narrow down to the following 3 chooses:
use SWIG to export the API to PHP or other script/web base language
use gSOAP to export the API as SOAP protocol
export the API as RESTful service (I can't find any exist framework, any suggestions?)
I want to compare them in terms of
stability
easy of use
performance
SWIG seems easy to use buy I am not sure the stability of it.
gSOAP seems very stable but a bit difficult to use and setup.
Any suggestion?
I personally used WSO2-WSF-CPP which is a C++ layer on top of AXIS2/2 to export legacy C++ code as web-service.
I tried back then gSOAP which worked quite well, but for stability and deployment reasons I choose WSO2, since AXIS2/C can be deployed easily as a module of the well know Apache2 HTTP server.
For the ease of use requirement I don't know if you plan to take WSDL file as a template to generate source code skeleton, but you can forget about this feature of the WSO2 package ... It seems to have been deprecated for a long time and the generated code is way too ugly to be maintained by hand.
Although doing a code generator yourself could be a good idea depending on the complexity and the amount of services you have. I recommend it! I did that and creating/building/generating services is quite straightforward now.
Another thing to notice about the WSO2 web services is that it's simple to build out of the box, and comes with stand-alone server to develop and test with. It was quite helpful (even if I am quite sure any decent web-service platform provides this kind of stuff like gSOAP does).

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

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).
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).
Can you guys help me out?
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.
Your C# programs continue to have the full SOAP access to your service.
Your C++ programs could do something like this for REST access:
"Browse" to the HTTP GET URL for the service command you wanted.
Then toss (or parse and use) whatever response came back.
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.
You may need to restrict the interface to simple data, or class objects that are easy to parse in C++.
Will the machines running the C++ applications have the .NET Framework installed?
Check out: Create WCF service for unmanaged C++ clients

Use gSOAP for VS 2003/C++ access to SOAP Web Service with WS-Security?

We have an upcoming project to allow an old platform that's only extensible with C++ / VS 2003 to call a SOAP-based web service that uses WS-Security.
My Google research indicates that gSOAP could be the best way to go.
I'm looking for validation and/or alternative suggestions.
I've been using gSoap with the wsse plugin for WS-Security using signatures on both the client and server side for both Windows and Linux. It took some doing, but it works well. It is extremely fast too.
It will require you to link OpenSSL with your project. I actually found a bug in the wsse plugin a few releases back that involved direct calls to OpenSSL for signature generation and validation. All of the bugs involved leaking OpenSSL structures. (The fixes were accepted into the source tree and are part of the current release.)
Overall, it really wasn't that difficult to get going. I used SoapUI (http://www.soapui.org/) to troubleshoot the signature generation when trying to validate if I was doing something wrong or the remote end was having issues.
If you're doing server side WS-Security under Apache2, you'll have to stick with the mod_gsoap 0.6 that comes with gSoap. I had to modify it a bit because it won't deal with WS-Security by default.
I believe, but didn't do a lot of investigation, that someone broke mod_gsoap 0.7 that is the current release available at SourceForge. It took me a while to figure out that 0.7 was segfaulting apache2, so maybe this will save you some pain.