开发者

Exposing C++ program as a Web Service

开发者 https://www.devze.com 2023-01-31 05:13 出处:网络
H开发者_如何学Cow 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.

H开发者_如何学Cow 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.


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

Use JNI to consume C++ program

  • Nice article from JavaWorld


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消