I’ve got a Ruby on Rails application, which needs to communicate with a backend C application, and I’m wondering what the consensus is for the best approach is to this.
The two applications will run on separate servers, with the Rails application on a (partially) public web address. The C application is entirely within a firewall. For security reasons, I don’t want them sharing a database. My initial approach is that web services is the right way to go.
Firstly, am I missing any potentially better alternatives to my web services assumption?
Secondly, while I’ve got plenty of experience using SOAP from C with gSOAP (and importantly, so does the person who will be writing the C-side!), Ruby on Rails prefers the REST model.
But what exactly does a RESTful interface from C code entail? Is there anything like gSOAP that does RESTFUL interfaces from C?
Does anyone have a feeling which is the path of least resistance here?
EDIT: forgot to mention that the C application does already have a web interface using Aapche / CGI.
For C calling Rails, libcurl is probably not too bad an option. Making REST calls is pretty simple, since it’s mostly url via string concatenation plus form-encoding. Examples are abundant:
http://curl.haxx.se/libcurl/c/example.html
If you need Rails to C via REST … ugh. Perhaps Apache and straight cgi? Or just wrap it in it’s own rails app and do the calls directly from that app? Seriously, If you need Rails to C via REST, I hope you get a good answer.