Reorganize folder structure.
This commit is contained in:
@@ -1,4 +0,0 @@
|
||||
add_executable(http_async_client main.cc)
|
||||
|
||||
target_link_libraries(http_async_client webcc ${Boost_LIBRARIES})
|
||||
target_link_libraries(http_async_client "${CMAKE_THREAD_LIBS_INIT}")
|
||||
@@ -1,4 +0,0 @@
|
||||
add_executable(http_client main.cc)
|
||||
|
||||
target_link_libraries(http_client webcc ${Boost_LIBRARIES})
|
||||
target_link_libraries(http_client "${CMAKE_THREAD_LIBS_INIT}")
|
||||
@@ -0,0 +1,4 @@
|
||||
add_executable(http_hello_async_client main.cc)
|
||||
|
||||
target_link_libraries(http_hello_async_client webcc ${Boost_LIBRARIES})
|
||||
target_link_libraries(http_hello_async_client "${CMAKE_THREAD_LIBS_INIT}")
|
||||
@@ -0,0 +1,4 @@
|
||||
add_executable(http_hello_client main.cc)
|
||||
|
||||
target_link_libraries(http_hello_client webcc ${Boost_LIBRARIES})
|
||||
target_link_libraries(http_hello_client "${CMAKE_THREAD_LIBS_INIT}")
|
||||
@@ -1,4 +1,4 @@
|
||||
file(GLOB SRCS *.cc *.h)
|
||||
set(SRCS book_services.cc book_services.h main.cc)
|
||||
|
||||
add_executable(rest_book_server ${SRCS})
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
#include "book_services.h"
|
||||
#include "example/rest_book_server/book_services.h"
|
||||
|
||||
#include <list>
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
|
||||
#include "boost/thread/thread.hpp"
|
||||
#include "json/json.h"
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "webcc/logger.h"
|
||||
#include "webcc/rest_server.h"
|
||||
|
||||
#include "book_services.h"
|
||||
#include "example/rest_book_server/book_services.h"
|
||||
|
||||
// In order to run with VLD, please copy the following files to the example
|
||||
// output folder from "third_party\win32\bin":
|
||||
@@ -1,4 +1,4 @@
|
||||
file(GLOB SRCS *.cc *.h)
|
||||
set(SRCS calc_client.cc calc_client.h main.cc)
|
||||
|
||||
add_executable(soap_calc_client ${SRCS})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "calc_client.h"
|
||||
#include "example/soap_calc_client/calc_client.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
@@ -73,8 +73,7 @@ bool CalcClient::Calc(const std::string& operation,
|
||||
|
||||
// Error handling if any.
|
||||
if (error != webcc::kNoError) {
|
||||
LOG_ERRO("Operation '%s' failed: %s",
|
||||
operation.c_str(),
|
||||
LOG_ERRO("Operation '%s' failed: %s", operation.c_str(),
|
||||
webcc::DescribeError(error));
|
||||
return false;
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
#define CALC_CLIENT_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "webcc/soap_client.h"
|
||||
|
||||
class CalcClient : public webcc::SoapClient {
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "webcc/logger.h"
|
||||
|
||||
#include "calc_client.h"
|
||||
#include "example/soap_calc_client/calc_client.h"
|
||||
|
||||
int main() {
|
||||
WEBCC_LOG_INIT("", webcc::LOG_CONSOLE);
|
||||
@@ -1,4 +1,4 @@
|
||||
file(GLOB SRCS *.cc *.h)
|
||||
set(SRCS calc_service.cc calc_service.h main.cc)
|
||||
|
||||
add_executable(soap_calc_server ${SRCS})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "calc_service.h"
|
||||
#include "example/soap_calc_server/calc_service.h"
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
@@ -80,12 +80,10 @@ bool CalcService::Handle(const webcc::SoapRequest& soap_request,
|
||||
}
|
||||
|
||||
bool CalcService::GetParameters(const webcc::SoapRequest& soap_request,
|
||||
double* x,
|
||||
double* y) {
|
||||
double* x, double* y) {
|
||||
try {
|
||||
*x = std::stod(soap_request.GetParameter("x"));
|
||||
*y = std::stod(soap_request.GetParameter("y"));
|
||||
|
||||
} catch (const std::exception& e) {
|
||||
LOG_ERRO("Parameter cast error: %s", e.what());
|
||||
return false;
|
||||
@@ -13,8 +13,7 @@ public:
|
||||
|
||||
private:
|
||||
bool GetParameters(const webcc::SoapRequest& soap_request,
|
||||
double* x,
|
||||
double* y);
|
||||
double* x, double* y);
|
||||
};
|
||||
|
||||
#endif // CALC_SERVICE_H_
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "webcc/logger.h"
|
||||
#include "webcc/soap_server.h"
|
||||
|
||||
#include "calc_service.h"
|
||||
#include "example/soap_calc_server/calc_service.h"
|
||||
|
||||
static void Help(const char* argv0) {
|
||||
std::cout << "Usage: " << argv0 << " <port>" << std::endl;
|
||||
@@ -20,16 +20,12 @@ int main(int argc, char* argv[]) {
|
||||
WEBCC_LOG_INIT("", webcc::LOG_CONSOLE);
|
||||
|
||||
std::uint16_t port = static_cast<std::uint16_t>(std::atoi(argv[1]));
|
||||
|
||||
std::size_t workers = 2;
|
||||
|
||||
try {
|
||||
webcc::SoapServer server(port, workers);
|
||||
|
||||
server.Bind(std::make_shared<CalcService>(), "/calculator");
|
||||
|
||||
server.Run();
|
||||
|
||||
} catch (const std::exception& e) {
|
||||
std::cerr << "Exception: " << e.what() << std::endl;
|
||||
return 1;
|
||||
Reference in New Issue
Block a user