简体   繁体   中英

Exposing C++ program as a Web Service

How to expose a C++ program as a Web Service? Or is it a better idea to invoke C++ from Java and expose the resultant Java as a Web Service.

In any case, the C++ program should not undergo any changes.

Interestingly, webservices work on http protocol, which means that you can't "host" a webservice written in C++ without having an http server. Since each web server will have it's own mechanism of writing "hooks" or extensions, the next obvious question is which web server would you like to chose.

Let's say you want IIS on Windows. It's possible to use ISAPI extensions; so you need to know how to write one, which complies with web services standards. Or, alternatively, it's better to learn how to do it in C++ with Visual Studio, which will have lots of built-in stuff to help you get started .

In short, there is no "standard" way of exposing a web service in C++ and you have to be "platform" specific. Windows with IIS has one way of doing it. Apache Axis C++ has another.

Consume C++ program in Java WebService end point and expose java webservice

Use JNI to consume C++ program

You can try c-sevice-interface https://github.com/Taymindis/c-service-interface .

It create a C/C++ program as a service port and listening to NGINX fcgi.

This is a small bridge engine which can handle high load of request, any segfault will not break the engine, it will catch and free the thread, it is built on top NGINX, FCGI. You can setup the proxy, load balance, authentication via NGINX before reach to your interface.

The link shown as below is a wiki to Guide you how to startup from scratch.

https://github.com/Taymindis/backcurl/wiki/How-to-build-BackCurl-for-cpp-Android-development

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM