If you haven’t seen it yet- watch this great and hilarious video (slightly NSFW):
Microsoft allows you to communicate via SOAP! 🙂
For those of you who haven’t heard of SOAP, a) the Wiki article and b) a quick explanation: SOAP is a network protocol, you can send XML-based messages to Web Services. Web Services are, well, an architecture concept and the interfaces (how functions, like “givemeapassword”, work)- are described by a WSDL file.
WSDL file + SOAP = communication from client to server.
Webservices are both a process and a set of protocols for finding and interfacing software over the network. WSDL describes how the data is transported, SOAP transports it in pretty XML-envelopes. You don’t need to worry about that, you just need to take care of your data. You get a) a description, that is, services self-explanatory and standardized, b) you can invoke them and c) you get results.
Do not just think about normal websites and services like that, think broader. A lot of things can be described by a client-server-architecture, for example, today I wrote an application where computers in a network communicate with some measurement device.
This link describes the process really well
Naturally, all the examples were in VB/.net/with ATL/used huge parts of the Microsoft toolchain (which is so, so unbelievably typical/why me??). This is not a bad toolchain, btw (and thank god we have Visual Studio Pro), but this is just a small part of a huge project, and we’re using mingw. And if you want to make mingw and VisualC++ compatible, well, just don’t.
So some research guided me to gSOAP.
gSOAP helps you to implement SOAP. And it’s really neat.
On the server side, you need a header file/specification of your functions, and the soap compiler generates your WSDL files (you also need to implement those C/ C++ functions, obviously.) I’m writing C/C++ because there is a compiler option for “pure” C code and a regular C++ one. I used the C option.
On the client side, you need that WSDL file. With the gSOAP compiler, it generates you function stubs for your program, and you just call them. Depending on the quality of your WSDL, you’ll just need to call them (which happened to me).
Check it out, and be sure to read the (excellent) documentation!
(But don’t mix two versions of gSOAP in one application. I was lucky that it threw a good error message, but to be honest, I don’t even know why I thought it should work..)