Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to call a Rest Service in C++?

I want to call a rest service written in WCF (which can support both XML and JSON Web Message Formats) from my C++ application.

What is the best solution to achieve this ? I have seen some utilities (gsoap) which create proxy classes for you to be used to call web services.

Can I achieve the same functionality without using any intermediate utility ? As its a rest service and it works using GET/PUT functions which are basic HTTP functions, is there any C++ library/Solution which could be used to invoke these function directly from a c++ application ?

like image 682
adnangohar Avatar asked Nov 24 '11 14:11

adnangohar


People also ask

Can you make API calls in C?

Applications call C API functions defined in C language header files, and a dynamic link library (DLL). Each function call returns an integer result code, defined in the ctgstdat. h header file. A function that completes normally returns the code CTG_STAT_OK .

What is the syntax for REST endpoint?

A RESTful query allows you to send a request or execute an operation by sending a single Universal Resource Identifier (URI) space to Service Manager. In general, the format for the URI resembles the following: http://{host}:{port}/{initialPath}


1 Answers

On Linux, you probably could use curl library (and I guess it is ported to Windows). Curl is a library providing HTTP client functionality to a C or C++ program.

like image 166
Basile Starynkevitch Avatar answered Sep 19 '22 14:09

Basile Starynkevitch