Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Writing a C++ SOAP (multithreaded) client application - without gSOAP

I am writing a multithreaded C++ (Linux) SOAP client to interface with the Betfair API. I initially tried to get to grips with gSOAP but I simply cannot get it to work properly using multiple WSDL files so that I have temporarily abandoned that. I have implemented my own classes for storing data and parsing/generating XML using RapidXML - the only thing that I am looking for advice on is what to use for the HTTPS transport aspect. I have implemented some initial test applications using OpenSSL and libcurl, these work fine but I have had some issues with the multithreaded aspects and they are more C than C++, and to be honest I was looking for something a little more up to date. So my question is this - If I were to rewrite this from scratch, what would be the best tool to use to deal with the HTTPS transport. I have researched the following as possibilities

  1. OpenSSL (implemented)
  2. libcurl (implemented)
  3. boost::asio library (not tried because as yet I have not dabbled with Boost)
  4. Try to do it all myself using socket programming (not keen on this approach)
  5. Just try and tough out gSOAP and trawl the web for ways to make it work.
  6. Something totally different that I have not come across yet.

So basically, given the above what would someone advise as the best approach to use in terms of solid performance and minimal multithreading problems? Or has anyone had any experience with poor performance of any of the above and would dissuade me from using it??? Any suggestions and advice will be gratefully received.

like image 375
mathematician1975 Avatar asked Jun 20 '12 19:06

mathematician1975


1 Answers

If you are worried about performance, in my experience boost::asio tends to scale very well especially in large multithreaded projects. Notice however that boost::asio is a quite low level socket oriented library, so you will have to dig pretty deep into that; there are some nice examples for HTTPS with boost::asio, e.g. this. I would reject your do-it-yourself socket idea, because that is just what boost::asio offers.

I personally have not worked with libcurl yet, but OpenSSL offers quite a high level API that should cover everything you need; you will buy convenience at the price of performance though. In most cases, the lack of performance will be marginal and thus neglectable, but that depends on your application.

gSOAP is great for client-sided SOAP requests, but to be honest, the server-sided support is rather minimal, and you would have to do a lot of tweaking to support multiple WSDL files in a multithreaded application. I would personally vote against doing that as well.

In conclusion, I would use boost::asio if you want to maximize performance and feel comfortable with sockets, and OpenSSL if convenience and rapid development have higher priority.

like image 197
nijansen Avatar answered Sep 22 '22 22:09

nijansen