My project is about to introduce SOAP. It's going to be used for C++ <-> Java and C++ <-> Flex communication. I'm responsible for refactoring our apps to take advantage of Java business rules engine and new Flex gui.
What resources are must read for C++ SOAP? I've read W3 materials. We're probably be using gSOAP on Solaris boxes.
There are some reasonably good books on SOAP, like Programming Web Services with SOAP by Snell, Tidwell, and Kulchenko; I've given that to people to introduce them to SOAP on projects in the past. I don't know of a C++-specific book, but the gSOAP site has pretty decent documentation.
I think the really key thing is probably to not dive into a complicated project right at first; there are some SOAP tutorials around, like this one, that build simple web services using gSOAP. Get the SOAP version of "Hello, world!" going firt, then maybe build that eBay client in the example, and you'll learn a lot of things you'd learn much more slowly and painfully trying to build a big example first.
Another option is to not use SOAP. Have you considered something like Protocol Buffers or Thrift?
Related
It's something totally new for me, and since it seems to be something trivial, I can't find any response with our beloved friend ggle...
My question is : I have to create a webapp that can work if the client have nothing on his computer but a browser. My question is : is it possible to include to my project an external library (here I want to use PCL (Point Cloud library), a C++ library), and make it works even if the client have nothing installed? If I use QtWebKit for example, will I be able to create this kind of webapp?
Thanks a lot, and sorry for the (maybe) stupid question, I never did web dev before, it's my first time. ...
Have a nice day!
Wow, that question is as broad as the day is long, but here goes (you don't give too much about your background so I apologise if I am going too basic).
A web browser is just a piece of software that knows how to process HTML, CSS and Javascript passed over HTTP from a TCP socket.
So, on a most basic level, to get something to work in a browser all you need is to write a program that listens on a TCP socket and passes headers and HTML in the body of the response as per the HTTP protocol.
So, leaving aside the socket part, your method may look something like this:
std::cout << "<h1>Hello, world!</h1>" << std::endl;
In fact, the vast majority of the original dynamic web sites worked just like this: they were just C programs that just happened to produce HTML as output in the old days (cgi-bin).
The main issue with this approach is it's very tedious and time consuming to write code to that level of detail to generate HTML, especially when you factor in CSS and JavaScript.
This is one of the key reasons that most web applications these days are implemented in Java, .Net, Ruby, PHP etc as there is a wealth of fully-featured, stable and mature frameworks for web development that take the grunt work out of creating dynamic web sites (and C/C++ is much rarer).
However there are a couple of good frameworks out there for C++ if that is definitely the language you want to use.
Wikipedia has a limited section on C++ frameworks but it covers the 2 I would suggest investigating (CppCMS and Wt):
https://en.wikipedia.org/wiki/Comparison_of_web_frameworks#C.2B.2B
Of these, I've only had direct experience of CppCMS but I can recommend it - it's approach is idiomatic C++ (to my eyes at least, but I must confess I am more often a Java web developer than C++)
Also, there is quite a useful if slightly dogmatic SO discussion on this thread that may be relevant:
How popular is C++ for making websites/web applications?
I am building a server-client application that involves heavy signal processing (e.g. FFT). I have a working application written in C++/Qt, where everything (signal processing and other calculations) is done in client and server just sends raw data. Now I feel it would be easier to implement these features on the server. So, that maintenance becomes easier.
As I am doing signal processing, I think I should stick to C++ for performance. But I am open to new ideas.
Constraints:
I need type checking so javascript is out of discussion.
Scaling includes adding more server and each server will have at the max
10-12 users. So, Hardware cost is important. I cannot use x number of
i7 processors.
No option of using cloud services.
So, right now my question is as follows:
How can I create web services using C++ for Linux server? (Although cross platform is not important, I would appreciate if I can achieve it.)
EDIT [02:09:2015]
Right now, I think the choice is between poco and C++ Rest SDK. I feel I should go for C++ Rest SDK. Mainly because it has only those features that I need. And Also it is supported by microsoft and uses boost internally. So, I feel in future, this might be well integreated with standard.
You could use cross-platform Poco library to implement HTTP server, it is really straightforward with this framework, and they have a lot of examples. You can also use JSON serialization (like rapidjson library) to implement REST service on top of HTTP - this way your Web service will be accesable by most of the modern Web frameworks.
You might want to take a look at the C++ Rest SDK, an open source, cross platform API from Microsoft.
Like #nogard suggested, I also recommend POCO for now. It's the most serious and feature-full solution. Given you mentioned Qt, I suggest you to take a look at Tufão.
EDIT:
I forgot to mention one comparison of mine on the C++ HTTP server frameworks.
If you directly handle HTTP requests, you might loose the functionality what Web Servers does well what it was build to do. I had a similar issue, what I did was wrap up my Qt c++ code inside a PHP extension. In your case you can do the same. Wrap your logic inside what ever technology you are about to use, doesn't matter it's PHP, net , Java or anything else.
I am looking for an alternative to gSoap / Axis C to create a C++ soap client. So far I haven't been able to find anything other then those two projects. gSoap's license it a little too restrictive while Axis seems just about abandoned.
I also detect a generate trend in the industry away from SOAP towards REST which I battle to understand. SOAP makes so many things a lot easier while rest seems very pedestrian. Are there any elegant frameworks which let you do REST in an object oriented way in C/C++?
It's old, but it works: SPROXY.EXE.
SPROXY.EXE is a command line tool that generates native C++ client code for accessing an XML Web service based on a WSDL description.
It's open source, you can get it from CodePlex.
Does anyone know of any really good C++ Libraries for implementing a web services api over top of existing legacy code?
I've got two portions that are in need of it:
An old-school client/server api (No, not web based, that's the problem)
An old cgi application that it integrates with the client and server.
Let me know if you've had any luck in the past implementing something like this using the library.
Microsoft has put out native code webservices API (WWSAPI) that looks pretty decent. I haven't had a chance to use it yet. We had originally ignored it, since it required Windows 7 or Server 2008, but they've finally released a runtime library for older OSs.
I would advise staying away from Microsoft's old SOAP SDK. For one, it's been deprecated; two, it's not terribly easy to distribute; and three, it's terrible to code for compared to the .NET offerings.
What we've done is written a bit of C++\CLI to interface our existing C++ codebase with .NETs webservice framework. This turned out to be remarkably easy. .NET will generate all the classes and boilerplate code you need based of of a WSDL file. Then you just write some C++\CLI code to handle the incoming data as managed classes and fill in some managed classes as responses.
You can use the Apache AXIS/C interface to build a web services interface. It has plugins for Apache and IIS (and I think FastCGI), and lets you talk web services to your legacy code.
I used gSOAP in a project and it was quite straightforward. Compared to Axis/C, I found it easier to learn and use. I never used POCO, can't give you an opinion, but it's gaining popularity recently. This is the link for gSOAP
http://www.cs.fsu.edu/~engelen/soap.html
Ideally, and you will think I am crazy, I can code some basic logic into a bash or korn script and open that functionality up to clients hitting them. There is a lot of plumbing involved in web services and I was wondering what tools and techniques more experienced developers have been using to prototype systems where a backend webservice may not be yet available. Do such tools exist for bash and ksh? What languages are the easiest to develop mockups in. BTW I am staring at an ecplipse IDE feeling a bit disgusted by what I am looking at. I just now got JBOSS installed and running... at its heart all these services are are socket connections to the client through a port ... or am I mistaken?
BTW: I am currently reading through this. And my disgust is increasing.
I share your disgust with eclipse. A language like Python is perfect for rapid prototyping. If you combine it with one of the many web frameworks (Pylons or Django would be my recommendation for Python), the amount of work you can accomplish quickly is astounding.
Seriously consider some other scripting language. I've been using Python and Ruby to build quick prototypes, and been very happy with them.
If you're free to make this choice, consider using a REST architecture instead of a WSDL and SOAP solution. RPC has its place, but if you can live with the restrictions of REST, life will be much easier. Even if you can't, it's a lot quicker for prototyping to use a dynamic language.