All Projects → brakmic → Cpp_REST

brakmic / Cpp_REST

Licence: other
🌐 REST with C++ SDK (Casablanca)

Programming Languages

C++
36643 projects - #6 most used programming language
C#
18002 projects
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Cpp REST

Spring-Boot-Application-Template
Spring Boot Web App, Flyway, MySQL, H2DB, Bootstrap, Thymeleaf, JWT, Swagger, API Rate Limiting, Docker, RBAC, i18n
Stars: ✭ 90 (+373.68%)
Mutual labels:  restful-webservices
location-api-sl
This API can be use to all developers to get location details of Sri Lanka 🇱🇰 including major cities, sub areas, districts and Provinces. ⛳️
Stars: ✭ 35 (+84.21%)
Mutual labels:  restful-webservices
IT API
The Internet services of the IT department of Alexander Technological Education Institute of Thessaloniki
Stars: ✭ 14 (-26.32%)
Mutual labels:  restful-webservices
grapevine
Fast, unopinionated, embeddable, minimalist web framework for .NET
Stars: ✭ 72 (+278.95%)
Mutual labels:  restful-webservices
gogo
Modern microservice web framework of golang
Stars: ✭ 40 (+110.53%)
Mutual labels:  restful-webservices
open-rest-es6-boilerplate
open-rest boilerplate project with es6
Stars: ✭ 24 (+26.32%)
Mutual labels:  restful-webservices
jdi-dark
Powerful Framework for Backend Automation Testing on Java (Rest, Soap, WebSocket)
Stars: ✭ 36 (+89.47%)
Mutual labels:  restful-webservices
Restbed
Corvusoft's Restbed framework brings asynchronous RESTful functionality to C++14 applications.
Stars: ✭ 1,551 (+8063.16%)
Mutual labels:  restful-webservices
Dropwizard
A damn simple library for building production-ready RESTful web services.
Stars: ✭ 8,078 (+42415.79%)
Mutual labels:  restful-webservices
behave-restful
BDD Framework to Test REST Services and APIs
Stars: ✭ 47 (+147.37%)
Mutual labels:  restful-webservices
pinipig
🚀 Performant webservice framework
Stars: ✭ 25 (+31.58%)
Mutual labels:  restful-webservices
nanoFramework.WebServer
📦 Web server for nanoFramework packed with features: REST api using attributes, multithread requests, parameters in query URL, static files serving.
Stars: ✭ 15 (-21.05%)
Mutual labels:  restful-webservices
RestSharpFramework
Framework for testing RESTful Services with RestSharp and C# HTTP Client
Stars: ✭ 18 (-5.26%)
Mutual labels:  restful-webservices
poco restful webservice
A RESTful API using Poco C++ Libraries.
Stars: ✭ 54 (+184.21%)
Mutual labels:  restful-webservices
REST-Api-with-Slim-PHP
REST API with PHP Slim Framework 3 and MySQL
Stars: ✭ 69 (+263.16%)
Mutual labels:  restful-webservices
TASK-Management-System
Spring Boot and Angular 7 web application for task management .
Stars: ✭ 34 (+78.95%)
Mutual labels:  restful-webservices
Android-Travel-Application
This application is an Android based travel application. Users can Login/Register on the application and their information is stored on Firebase, a cloud based NoSQL Database. When a user has logged in they are brought to their profile page, which will display their personal registration information and allow them to upload a profile picture by …
Stars: ✭ 35 (+84.21%)
Mutual labels:  restful-webservices

HTTP-Clients based on C++ REST SDK & C#

This demo consists of three small VS projects:

a) C++ DLL with exported functions

b) C++ Console App using headers from DLL

c) C# Console App using DllImport

The DLL Exports are as follows:

C++ Client App

The C++ App uses the Connector.h header from DLL to create a unique_ptr of the Connector class.

Connector utilizes internally the C++ REST SDK (Casablanca) to call a publicly available JSON Echo service.

To make this example a little bit more realistic the method GetJson expects a function object. This object (a function pointer) is used to display the JSON response. There's also a possibility to send additional headers.

Inside the GetJson method the server communication is handled asynchronously via objects & functions from the pplx namespace.

C# Client App

The .NET App imposes several restrictions to exported functions. Instead of C++ function templates I had to use old-style C function pointers. This is because .NET can only marshal Delegates to function pointers. The same happened to the C++ string class. It was replaced by raw wchar_t pointers. Ugly, but playing with .NET DllImport is always rather unpleasant.

This is how the whole DllImport soup looks like:

First, we declare a delegate and decorate it as an "unmanaged" (that is, non-NET callable) function pointer. Also, we set the calling convention to StdCall. This means that the callee (the DLL function) will be responsible to clean the stack and not the caller (the Client). More info on argument passing and calling conventions here.

Second, we grab the DLL which hopefully exports the desired function. In this case the Connector.dll should be located where the executing assembly is. In other cases we'd adjust the first argument after [DllImport] Attribute. Also, the same calling convention is applied. Now, it's important to know that functions from non-NET DLLs are statically imported externals and very often demand special treatment of passed arguments. In this case we have to marshal a pure .NET entity, the Delegate to a raw function pointer To achieve this we use attribute [MarshalAs] and decorate the OnCompletedDelegate as unmanaged function pointer.

Finally, the C++ DLL will be able to "call back" our delegate as soon as the JSON Echo Server delivers a response.

Example, C++ client calling service & passing additional headers

Example, C# client calling service

IMPORTANT

The clients need these two libraries to be located in their root folders:

Connector.dll

cpprest120d_2_4.dll (this is the library from C++ REST SDK and can be installed via Nuget)

LICENSE

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].