Feedback about the C++ REST SDK listener library

Oct 28, 2013 at 7:53 PM
As you all know, C++ REST SDK has a HTTP listener library under the web::http::experimental namespace. We are currently in the process of moving the HTTP listener library into production and would love to incorporate your feedback. The HTTP listener library consists of: listener object that accepts messages at a particular URI and dispatches it to custom handlers. Additionally, we have the URI (web::http::uri), JSON (web::json) and streams (concurrency::streams) library to help with authoring an end to end REST service.

In order to achieve production quality, we would love to hear your feedback around things like
• Have you run into any issues or functionality bugs when you used the feature?
• Is the feature usable? Are the interfaces and APIs intuitive to use?
• Does the C++ REST SDK http_listener help you build scalable web services?
• Is there additional listener features you would like to see?

Apart from feedback, we would be more than happy to work with you to incorporate the listener library in your project. So drop us an email at askcasablanca@microsoft.com to start the collaboration.

Looking forward to your help in making the C++ REST SDK better.

Thanks
Kavya.
Nov 6, 2013 at 3:33 PM
Hi,
I'm trying to use the HTTP listener library with Ubuntu 13.04

That's my code:
#include <cpprest/http_listener.h>

using namespace web;
using namespace web::http;
using namespace web::http::experimental:listener;

void handle(http_request request) { }

int main(){
    http_listener listener("http://localhost/restdemo");
    listener.support(methods::GET, handle);
    return 0;
}   
But I'm getting this error code
Invalid arguments
Candidates are:
void support(?)
void support(const std::basic_string<char,std::char_traits<char>,std::allocator<char>> &, ?)
Nov 6, 2013 at 7:45 PM
Hi,

We have not come across this issue before. Your sample code looks good. BTW, we need to call listener.open() to actually start listening.
I need some more information to investigate this:
  1. Which version of gcc are you using?
  2. Could you please share the Makefile contents used to build the code.
  3. Were you able to build the listener tests or our samples?
  4. Tests are under Release\tests\Functional\http\listener
  5. Samples are under Release\samples ? The BlackJack\BlackJack_Server uses the listener.
    Let us know if these samples also fail to build.
Thanks
Kavya.
Nov 7, 2013 at 8:19 AM
Hi,
  • I'm using gcc version 4.8.1
  • The build file for my test code
Invoking: GCC C++ Compiler
g++ -L/home/ab1072/test/Binaries/Release64 -L/usr/lib -o "RestListener"  ./HTTP_Listener.o   -lboost_system -lcommon_utilities -lhttptest_utilities -lunittestpp -lcasablanca
  • I couldn't build one of the test files, too. There are plenty of "undefined reference to" errors when I'm tried.
  • For the BlackJack_Server Sample I'm also getting similar errors, like
Description Resource    Path    Location    Type
Invalid arguments '
Candidates are:
pplx::task<void> reply(web::http::http_response)
pplx::task<void> reply(unsigned short int)
pplx::task<void> reply(unsigned short int, const web::json::value &)
pplx::task<void> reply(unsigned short int, std::basic_string<char,std::char_traits<char>,std::allocator<char>>, std::basic_string<char,std::char_traits<char>,std::allocator<char>>)
pplx::task<void> reply(unsigned short int, Concurrency::streams::basic_istream<unsigned char>, std::basic_string<char,std::char_traits<char>,std::allocator<char>>)
pplx::task<void> reply(unsigned short int, Concurrency::streams::basic_istream<unsigned char>, unsigned long int, std::basic_string<char,std::char_traits<char>,std::allocator<char>>)
'   Table.cpp   /RestListener   line 106    Semantic Error
in the Table.cpp.
But all the tests pass when I'm running the run_tests.sh

hsgimit
Nov 7, 2013 at 10:50 AM
Hi,

after some additonal searching I thought of switching the IDE. Now I'm usying Netbeans 7.4 and the Code worked on the first try.

hsgimit