Rename project from csoap to webcc
This commit is contained in:
+7
-6
@@ -1,14 +1,15 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(csoap)
|
||||
project(webcc)
|
||||
|
||||
option(CSOAP_ENABLE_SOAP "Enable SOAP support (need PugiXml)?" ON)
|
||||
option(CSOAP_ENABLE_UT "Enable unit test?" OFF)
|
||||
option(WEBCC_ENABLE_SOAP "Enable SOAP support (need PugiXml)?" ON)
|
||||
option(WEBCC_ENABLE_UT "Enable unit test?" ON)
|
||||
option(WEBCC_ENABLE_DEMO "Enable demo programs?" ON)
|
||||
|
||||
if(CSOAP_ENABLE_SOAP)
|
||||
add_definitions(-DCSOAP_ENABLE_SOAP)
|
||||
if(WEBCC_ENABLE_SOAP)
|
||||
add_definitions(-DWEBCC_ENABLE_SOAP)
|
||||
endif()
|
||||
|
||||
if(CSOAP_ENABLE_UT)
|
||||
if(WEBCC_ENABLE_UT)
|
||||
enable_testing()
|
||||
endif()
|
||||
|
||||
|
||||
+5
-3
@@ -1,11 +1,13 @@
|
||||
if(CSOAP_ENABLE_UT)
|
||||
if(WEBCC_ENABLE_UT)
|
||||
add_subdirectory(gtest)
|
||||
add_subdirectory(csoap_unittest)
|
||||
add_subdirectory(webcc_unittest)
|
||||
endif()
|
||||
|
||||
add_subdirectory(pugixml)
|
||||
|
||||
add_subdirectory(csoap)
|
||||
add_subdirectory(webcc)
|
||||
|
||||
if(WEBCC_ENABLE_DEMO)
|
||||
add_subdirectory(demo/soap/calc_client)
|
||||
add_subdirectory(demo/soap/calc_server)
|
||||
endif()
|
||||
@@ -1,16 +0,0 @@
|
||||
if(UNIX)
|
||||
add_definitions(-D_GLIBCXX_USE_WCHAR_T -std=c++11)
|
||||
endif()
|
||||
|
||||
option(CSOAP_DEBUG_OUTPUT "Enable debug output?" OFF)
|
||||
|
||||
if(CSOAP_DEBUG_OUTPUT)
|
||||
add_definitions(-DCSOAP_DEBUG_OUTPUT)
|
||||
endif()
|
||||
|
||||
# Don't use any deprecated definitions (e.g., io_service).
|
||||
add_definitions(-DBOOST_ASIO_NO_DEPRECATED)
|
||||
|
||||
file(GLOB SRCS *.cc *.h)
|
||||
|
||||
add_library(csoap ${SRCS})
|
||||
@@ -2,4 +2,4 @@ file(GLOB SRCS *.cc *.h)
|
||||
|
||||
add_executable(soap_calc_client ${SRCS})
|
||||
|
||||
target_link_libraries(soap_calc_client csoap pugixml)
|
||||
target_link_libraries(soap_calc_client webcc pugixml)
|
||||
|
||||
@@ -22,7 +22,7 @@ bool CalcClient::Divide(double x, double y, double* result) {
|
||||
return Calc("divide", "numerator", "denominator", x, y, result);
|
||||
}
|
||||
|
||||
// Set to 0 to test our own calculator server created with csoap.
|
||||
// Set to 0 to test our own calculator server created with webcc.
|
||||
#define ACCESS_PARASOFT 0
|
||||
|
||||
void CalcClient::Init() {
|
||||
@@ -48,19 +48,19 @@ bool CalcClient::Calc(const std::string& operation,
|
||||
double y,
|
||||
double* result) {
|
||||
// Prepare parameters.
|
||||
std::vector<csoap::Parameter> parameters{
|
||||
std::vector<webcc::Parameter> parameters{
|
||||
{ x_name, x },
|
||||
{ y_name, y }
|
||||
};
|
||||
|
||||
// Make the call.
|
||||
std::string result_str;
|
||||
csoap::Error error = Call(operation, std::move(parameters), &result_str);
|
||||
webcc::Error error = Call(operation, std::move(parameters), &result_str);
|
||||
|
||||
// Error handling if any.
|
||||
if (error != csoap::kNoError) {
|
||||
if (error != webcc::kNoError) {
|
||||
std::cerr << "Error: " << error;
|
||||
std::cerr << ", " << csoap::GetErrorMessage(error) << std::endl;
|
||||
std::cerr << ", " << webcc::GetErrorMessage(error) << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
#define CALC_CLIENT_H_
|
||||
|
||||
#include <string>
|
||||
#include "csoap/soap_client.h"
|
||||
#include "webcc/soap_client.h"
|
||||
|
||||
class CalcClient : public csoap::SoapClient {
|
||||
class CalcClient : public webcc::SoapClient {
|
||||
public:
|
||||
CalcClient();
|
||||
|
||||
|
||||
@@ -2,4 +2,4 @@ file(GLOB SRCS *.cc *.h)
|
||||
|
||||
add_executable(soap_calc_server ${SRCS})
|
||||
|
||||
target_link_libraries(soap_calc_server csoap pugixml)
|
||||
target_link_libraries(soap_calc_server webcc pugixml)
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
#include "boost/lexical_cast.hpp"
|
||||
|
||||
#include "csoap/soap_request.h"
|
||||
#include "csoap/soap_response.h"
|
||||
#include "webcc/soap_request.h"
|
||||
#include "webcc/soap_response.h"
|
||||
|
||||
bool CalcService::Handle(const csoap::SoapRequest& soap_request,
|
||||
csoap::SoapResponse* soap_response) {
|
||||
bool CalcService::Handle(const webcc::SoapRequest& soap_request,
|
||||
webcc::SoapResponse* soap_response) {
|
||||
try {
|
||||
if (soap_request.operation() == "add") {
|
||||
double x = boost::lexical_cast<double>(soap_request.GetParameter("x"));
|
||||
@@ -14,7 +14,7 @@ bool CalcService::Handle(const csoap::SoapRequest& soap_request,
|
||||
|
||||
double result = x + y;
|
||||
|
||||
soap_response->set_soapenv_ns(csoap::kSoapEnvNamespace);
|
||||
soap_response->set_soapenv_ns(webcc::kSoapEnvNamespace);
|
||||
soap_response->set_service_ns({
|
||||
"cal",
|
||||
"http://www.example.com/calculator/"
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
#ifndef CALC_SERVICE_H_
|
||||
#define CALC_SERVICE_H_
|
||||
|
||||
#include "csoap/soap_service.h"
|
||||
#include "webcc/soap_service.h"
|
||||
|
||||
class CalcService : public csoap::SoapService {
|
||||
class CalcService : public webcc::SoapService {
|
||||
public:
|
||||
CalcService() = default;
|
||||
~CalcService() override = default;
|
||||
|
||||
bool Handle(const csoap::SoapRequest& soap_request,
|
||||
csoap::SoapResponse* soap_response) override;
|
||||
bool Handle(const webcc::SoapRequest& soap_request,
|
||||
webcc::SoapResponse* soap_response) override;
|
||||
};
|
||||
|
||||
#endif // CALC_SERVICE_H_
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <iostream>
|
||||
#include "csoap/soap_server.h"
|
||||
#include "webcc/soap_server.h"
|
||||
#include "calc_service.h"
|
||||
|
||||
static void Help(const char* argv0) {
|
||||
@@ -19,7 +19,7 @@ int main(int argc, char* argv[]) {
|
||||
std::size_t workers = 2;
|
||||
|
||||
try {
|
||||
csoap::SoapServer server(port, workers);
|
||||
webcc::SoapServer server(port, workers);
|
||||
|
||||
server.RegisterService(std::make_shared<CalcService>(),
|
||||
"/calculator");
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
option(WEBCC_DEBUG_OUTPUT "Enable debug output?" OFF)
|
||||
|
||||
if(WEBCC_DEBUG_OUTPUT)
|
||||
add_definitions(-DWEBCC_DEBUG_OUTPUT)
|
||||
endif()
|
||||
|
||||
# Don't use any deprecated definitions (e.g., io_service).
|
||||
add_definitions(-DBOOST_ASIO_NO_DEPRECATED)
|
||||
|
||||
file(GLOB SRCS *.cc *.h)
|
||||
|
||||
add_library(webcc ${SRCS})
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "csoap/common.h"
|
||||
#include "webcc/common.h"
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
// NOTE:
|
||||
// Field names are case-insensitive.
|
||||
@@ -103,4 +103,4 @@ Parameter& Parameter::operator=(Parameter&& rhs) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
@@ -1,12 +1,12 @@
|
||||
#ifndef CSOAP_COMMON_H_
|
||||
#define CSOAP_COMMON_H_
|
||||
#ifndef WEBCC_COMMON_H_
|
||||
#define WEBCC_COMMON_H_
|
||||
|
||||
// Common definitions.
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -155,6 +155,6 @@ private:
|
||||
std::string value_;
|
||||
};
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
|
||||
#endif // CSOAP_COMMON_H_
|
||||
#endif // WEBCC_COMMON_H_
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "csoap/http_client.h"
|
||||
#include "webcc/http_client.h"
|
||||
|
||||
#if CSOAP_DEBUG_OUTPUT
|
||||
#if WEBCC_DEBUG_OUTPUT
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
#include "boost/asio/write.hpp"
|
||||
#endif
|
||||
|
||||
#include "csoap/http_response_parser.h"
|
||||
#include "csoap/http_request.h"
|
||||
#include "csoap/http_response.h"
|
||||
#include "webcc/http_response_parser.h"
|
||||
#include "webcc/http_request.h"
|
||||
#include "webcc/http_response.h"
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -82,7 +82,7 @@ Error HttpClient::SendRequest(const HttpRequest& request,
|
||||
|
||||
// Send HTTP request.
|
||||
|
||||
#if CSOAP_DEBUG_OUTPUT
|
||||
#if WEBCC_DEBUG_OUTPUT
|
||||
std::cout << "# REQUEST" << std::endl << request << std::endl;
|
||||
#endif
|
||||
|
||||
@@ -92,7 +92,7 @@ Error HttpClient::SendRequest(const HttpRequest& request,
|
||||
return kSocketWriteError;
|
||||
}
|
||||
|
||||
#if CSOAP_DEBUG_OUTPUT
|
||||
#if WEBCC_DEBUG_OUTPUT
|
||||
std::cout << "# RESPONSE" << std::endl;
|
||||
#endif
|
||||
|
||||
@@ -114,7 +114,7 @@ Error HttpClient::SendRequest(const HttpRequest& request,
|
||||
}
|
||||
}
|
||||
|
||||
#if CSOAP_DEBUG_OUTPUT
|
||||
#if WEBCC_DEBUG_OUTPUT
|
||||
// NOTE: the content XML might not be well formated.
|
||||
std::cout.write(buffer_.data(), length);
|
||||
#endif
|
||||
@@ -129,7 +129,7 @@ Error HttpClient::SendRequest(const HttpRequest& request,
|
||||
}
|
||||
}
|
||||
|
||||
#if CSOAP_DEBUG_OUTPUT
|
||||
#if WEBCC_DEBUG_OUTPUT
|
||||
std::cout << std::endl;
|
||||
std::cout << "# RESPONSE (PARSED)" << std::endl;
|
||||
std::cout << *response << std::endl;
|
||||
@@ -138,4 +138,4 @@ Error HttpClient::SendRequest(const HttpRequest& request,
|
||||
return kNoError;
|
||||
}
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
@@ -1,13 +1,13 @@
|
||||
#ifndef CSOAP_HTTP_CLIENT_H_
|
||||
#define CSOAP_HTTP_CLIENT_H_
|
||||
#ifndef WEBCC_HTTP_CLIENT_H_
|
||||
#define WEBCC_HTTP_CLIENT_H_
|
||||
|
||||
#include <array>
|
||||
|
||||
#include "boost/asio/io_context.hpp"
|
||||
|
||||
#include "csoap/common.h"
|
||||
#include "webcc/common.h"
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
class HttpRequest;
|
||||
class HttpResponse;
|
||||
@@ -31,6 +31,6 @@ private:
|
||||
int timeout_seconds_;
|
||||
};
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
|
||||
#endif // CSOAP_HTTP_CLIENT_H_
|
||||
#endif // WEBCC_HTTP_CLIENT_H_
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "csoap/http_message.h"
|
||||
#include "webcc/http_message.h"
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
void HttpMessage::SetHeader(const std::string& name, const std::string& value) {
|
||||
for (HttpHeader& h : headers_) {
|
||||
@@ -13,4 +13,4 @@ void HttpMessage::SetHeader(const std::string& name, const std::string& value) {
|
||||
headers_.push_back({ name, value });
|
||||
}
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifndef CSOAP_HTTP_MESSAGE_H_
|
||||
#define CSOAP_HTTP_MESSAGE_H_
|
||||
#ifndef WEBCC_HTTP_MESSAGE_H_
|
||||
#define WEBCC_HTTP_MESSAGE_H_
|
||||
|
||||
#include <cassert>
|
||||
#include <string>
|
||||
#include "csoap/common.h"
|
||||
#include "webcc/common.h"
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
class HttpHeader {
|
||||
public:
|
||||
@@ -81,6 +81,6 @@ protected:
|
||||
std::string content_;
|
||||
};
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
|
||||
#endif // CSOAP_HTTP_MESSAGE_H_
|
||||
#endif // WEBCC_HTTP_MESSAGE_H_
|
||||
@@ -1,11 +1,11 @@
|
||||
#include "csoap/http_parser.h"
|
||||
#include "webcc/http_parser.h"
|
||||
|
||||
#include "boost/algorithm/string.hpp"
|
||||
#include "boost/lexical_cast.hpp"
|
||||
|
||||
#include "csoap/http_message.h"
|
||||
#include "webcc/http_message.h"
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
HttpParser::HttpParser(HttpMessage* message)
|
||||
: message_(message)
|
||||
@@ -107,4 +107,4 @@ void HttpParser::ParseContentLength(const std::string& line) {
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
@@ -1,10 +1,10 @@
|
||||
#ifndef CSOAP_HTTP_PARSER_H_
|
||||
#define CSOAP_HTTP_PARSER_H_
|
||||
#ifndef WEBCC_HTTP_PARSER_H_
|
||||
#define WEBCC_HTTP_PARSER_H_
|
||||
|
||||
#include <string>
|
||||
#include "csoap/common.h"
|
||||
#include "webcc/common.h"
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
class HttpMessage;
|
||||
|
||||
@@ -40,6 +40,6 @@ protected:
|
||||
bool finished_;
|
||||
};
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
|
||||
#endif // CSOAP_HTTP_PARSER_H_
|
||||
#endif // WEBCC_HTTP_PARSER_H_
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "csoap/http_request.h"
|
||||
#include "webcc/http_request.h"
|
||||
|
||||
#include "boost/algorithm/string.hpp"
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const HttpRequest& request) {
|
||||
os << request.start_line();
|
||||
@@ -68,4 +68,4 @@ std::vector<boost::asio::const_buffer> HttpRequest::ToBuffers() const {
|
||||
return buffers;
|
||||
}
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifndef CSOAP_HTTP_REQUEST_H_
|
||||
#define CSOAP_HTTP_REQUEST_H_
|
||||
#ifndef WEBCC_HTTP_REQUEST_H_
|
||||
#define WEBCC_HTTP_REQUEST_H_
|
||||
|
||||
#include <string>
|
||||
#include "boost/asio/buffer.hpp" // for const_buffer
|
||||
#include "csoap/http_message.h"
|
||||
#include "webcc/http_message.h"
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
class HttpRequest;
|
||||
|
||||
@@ -73,6 +73,6 @@ private:
|
||||
std::string port_;
|
||||
};
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
|
||||
#endif // CSOAP_HTTP_REQUEST_H_
|
||||
#endif // WEBCC_HTTP_REQUEST_H_
|
||||
@@ -1,16 +1,16 @@
|
||||
#include "csoap/http_request_handler.h"
|
||||
#include "webcc/http_request_handler.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#if CSOAP_DEBUG_OUTPUT
|
||||
#if WEBCC_DEBUG_OUTPUT
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
#include "csoap/common.h"
|
||||
#include "csoap/http_request.h"
|
||||
#include "csoap/http_response.h"
|
||||
#include "webcc/common.h"
|
||||
#include "webcc/http_request.h"
|
||||
#include "webcc/http_response.h"
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
void HttpRequestHandler::Enqueue(HttpSessionPtr session) {
|
||||
queue_.Push(session);
|
||||
@@ -20,25 +20,25 @@ void HttpRequestHandler::Start(std::size_t count) {
|
||||
assert(count > 0 && workers_.size() == 0);
|
||||
|
||||
for (std::size_t i = 0; i < count; ++i) {
|
||||
#if CSOAP_DEBUG_OUTPUT
|
||||
#if WEBCC_DEBUG_OUTPUT
|
||||
boost::thread* worker =
|
||||
#endif
|
||||
workers_.create_thread(std::bind(&HttpRequestHandler::WorkerRoutine, this));
|
||||
|
||||
#if CSOAP_DEBUG_OUTPUT
|
||||
#if WEBCC_DEBUG_OUTPUT
|
||||
std::cout << "Worker is running (thread: " << worker->get_id() << ")\n";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void HttpRequestHandler::Stop() {
|
||||
#if CSOAP_DEBUG_OUTPUT
|
||||
#if WEBCC_DEBUG_OUTPUT
|
||||
std::cout << "Stopping workers...\n";
|
||||
#endif
|
||||
|
||||
// Close pending sessions.
|
||||
for (HttpSessionPtr conn = queue_.Pop(); conn; conn = queue_.Pop()) {
|
||||
#if CSOAP_DEBUG_OUTPUT
|
||||
#if WEBCC_DEBUG_OUTPUT
|
||||
std::cout << "Closing pending session...\n";
|
||||
#endif
|
||||
conn->Stop();
|
||||
@@ -49,13 +49,13 @@ void HttpRequestHandler::Stop() {
|
||||
|
||||
workers_.join_all();
|
||||
|
||||
#if CSOAP_DEBUG_OUTPUT
|
||||
#if WEBCC_DEBUG_OUTPUT
|
||||
std::cout << "All workers have been stopped.\n";
|
||||
#endif
|
||||
}
|
||||
|
||||
void HttpRequestHandler::WorkerRoutine() {
|
||||
#if CSOAP_DEBUG_OUTPUT
|
||||
#if WEBCC_DEBUG_OUTPUT
|
||||
boost::thread::id thread_id = boost::this_thread::get_id();
|
||||
#endif
|
||||
|
||||
@@ -63,7 +63,7 @@ void HttpRequestHandler::WorkerRoutine() {
|
||||
HttpSessionPtr session = queue_.PopOrWait();
|
||||
|
||||
if (!session) {
|
||||
#if CSOAP_DEBUG_OUTPUT
|
||||
#if WEBCC_DEBUG_OUTPUT
|
||||
std::cout << "Worker is going to stop (thread: " << thread_id << ")\n";
|
||||
#endif
|
||||
// For stopping next worker.
|
||||
@@ -77,4 +77,4 @@ void HttpRequestHandler::WorkerRoutine() {
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
@@ -1,16 +1,16 @@
|
||||
#ifndef CSOAP_HTTP_REQUEST_HANDLER_H_
|
||||
#define CSOAP_HTTP_REQUEST_HANDLER_H_
|
||||
#ifndef WEBCC_HTTP_REQUEST_HANDLER_H_
|
||||
#define WEBCC_HTTP_REQUEST_HANDLER_H_
|
||||
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
#include "boost/thread/thread.hpp"
|
||||
|
||||
#include "csoap/http_session.h"
|
||||
#include "csoap/queue.h"
|
||||
#include "csoap/soap_service.h"
|
||||
#include "webcc/http_session.h"
|
||||
#include "webcc/queue.h"
|
||||
#include "webcc/soap_service.h"
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
class HttpRequest;
|
||||
class HttpResponse;
|
||||
@@ -46,6 +46,6 @@ private:
|
||||
boost::thread_group workers_;
|
||||
};
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
|
||||
#endif // CSOAP_HTTP_REQUEST_HANDLER_H_
|
||||
#endif // WEBCC_HTTP_REQUEST_HANDLER_H_
|
||||
@@ -1,11 +1,11 @@
|
||||
#include "csoap/http_request_parser.h"
|
||||
#include "webcc/http_request_parser.h"
|
||||
|
||||
#include <vector>
|
||||
#include "boost/algorithm/string.hpp"
|
||||
|
||||
#include "csoap/http_request.h"
|
||||
#include "webcc/http_request.h"
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
HttpRequestParser::HttpRequestParser(HttpRequest* request)
|
||||
: HttpParser(request), request_(request) {
|
||||
@@ -13,7 +13,7 @@ HttpRequestParser::HttpRequestParser(HttpRequest* request)
|
||||
|
||||
Error HttpRequestParser::ParseStartLine(const std::string& line) {
|
||||
std::vector<std::string> strs;
|
||||
boost::split(strs, line, boost::is_any_of(" "));
|
||||
boost::split(strs, line, boost::is_any_of(" "), boost::token_compress_on);
|
||||
|
||||
if (strs.size() != 3) {
|
||||
return kHttpStartLineError;
|
||||
@@ -27,4 +27,4 @@ Error HttpRequestParser::ParseStartLine(const std::string& line) {
|
||||
return kNoError;
|
||||
}
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef CSOAP_HTTP_REQUEST_PARSER_H_
|
||||
#define CSOAP_HTTP_REQUEST_PARSER_H_
|
||||
#ifndef WEBCC_HTTP_REQUEST_PARSER_H_
|
||||
#define WEBCC_HTTP_REQUEST_PARSER_H_
|
||||
|
||||
#include "csoap/http_parser.h"
|
||||
#include "webcc/http_parser.h"
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
class HttpRequest;
|
||||
|
||||
@@ -18,6 +18,6 @@ private:
|
||||
HttpRequest* request_;
|
||||
};
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
|
||||
#endif // CSOAP_HTTP_REQUEST_PARSER_H_
|
||||
#endif // WEBCC_HTTP_REQUEST_PARSER_H_
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "csoap/http_response.h"
|
||||
#include "webcc/http_response.h"
|
||||
|
||||
#include "csoap/common.h"
|
||||
#include "csoap/xml.h"
|
||||
#include "webcc/common.h"
|
||||
#include "webcc/xml.h"
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const HttpResponse& response) {
|
||||
os << response.start_line();
|
||||
@@ -118,4 +118,4 @@ HttpResponse HttpResponse::Fault(HttpStatus::Enum status) {
|
||||
return response;
|
||||
}
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifndef CSOAP_HTTP_RESPONSE_H_
|
||||
#define CSOAP_HTTP_RESPONSE_H_
|
||||
#ifndef WEBCC_HTTP_RESPONSE_H_
|
||||
#define WEBCC_HTTP_RESPONSE_H_
|
||||
|
||||
#include <string>
|
||||
#include "boost/asio/buffer.hpp" // for const_buffer
|
||||
#include "csoap/http_message.h"
|
||||
#include "webcc/http_message.h"
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
class HttpResponse;
|
||||
|
||||
@@ -38,6 +38,6 @@ private:
|
||||
int status_ = HttpStatus::kOK; // TODO: HttpStatus
|
||||
};
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
|
||||
#endif // CSOAP_HTTP_RESPONSE_H_
|
||||
#endif // WEBCC_HTTP_RESPONSE_H_
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "csoap/http_response_parser.h"
|
||||
#include "webcc/http_response_parser.h"
|
||||
#include "boost/lexical_cast.hpp"
|
||||
#include "csoap/http_response.h"
|
||||
#include "webcc/http_response.h"
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
HttpResponseParser::HttpResponseParser(HttpResponse* response)
|
||||
: HttpParser(response)
|
||||
@@ -46,4 +46,4 @@ Error HttpResponseParser::ParseStartLine(const std::string& line) {
|
||||
return kNoError;
|
||||
}
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef CSOAP_HTTP_RESPONSE_PARSER_H_
|
||||
#define CSOAP_HTTP_RESPONSE_PARSER_H_
|
||||
#ifndef WEBCC_HTTP_RESPONSE_PARSER_H_
|
||||
#define WEBCC_HTTP_RESPONSE_PARSER_H_
|
||||
|
||||
#include "csoap/http_parser.h"
|
||||
#include "webcc/http_parser.h"
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
class HttpResponse;
|
||||
|
||||
@@ -20,6 +20,6 @@ private:
|
||||
HttpResponse* response_;
|
||||
};
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
|
||||
#endif // CSOAP_HTTP_RESPONSE_PARSER_H_
|
||||
#endif // WEBCC_HTTP_RESPONSE_PARSER_H_
|
||||
@@ -1,18 +1,18 @@
|
||||
#include "csoap/http_server.h"
|
||||
#include "webcc/http_server.h"
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
#if CSOAP_DEBUG_OUTPUT
|
||||
#if WEBCC_DEBUG_OUTPUT
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
#include "csoap/http_request_handler.h"
|
||||
#include "csoap/soap_service.h"
|
||||
#include "csoap/utility.h"
|
||||
#include "webcc/http_request_handler.h"
|
||||
#include "webcc/soap_service.h"
|
||||
#include "webcc/utility.h"
|
||||
|
||||
using tcp = boost::asio::ip::tcp;
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
HttpServer::HttpServer(unsigned short port, std::size_t workers)
|
||||
: signals_(io_context_)
|
||||
@@ -49,7 +49,7 @@ HttpServer::~HttpServer() {
|
||||
void HttpServer::Run() {
|
||||
assert(request_handler_ != NULL);
|
||||
|
||||
#if CSOAP_DEBUG_OUTPUT
|
||||
#if WEBCC_DEBUG_OUTPUT
|
||||
boost::thread::id thread_id = boost::this_thread::get_id();
|
||||
std::cout << "Server main thread: " << thread_id << std::endl;
|
||||
#endif
|
||||
@@ -95,4 +95,4 @@ void HttpServer::DoAwaitStop() {
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef CSOAP_HTTP_SERVER_H_
|
||||
#define CSOAP_HTTP_SERVER_H_
|
||||
#ifndef WEBCC_HTTP_SERVER_H_
|
||||
#define WEBCC_HTTP_SERVER_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -11,9 +11,9 @@
|
||||
#include "boost/asio/signal_set.hpp"
|
||||
#include "boost/asio/ip/tcp.hpp"
|
||||
|
||||
#include "csoap/http_session.h"
|
||||
#include "webcc/http_session.h"
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
class HttpRequestHandler;
|
||||
|
||||
@@ -57,6 +57,6 @@ private:
|
||||
boost::scoped_ptr<boost::asio::ip::tcp::acceptor> acceptor_;
|
||||
};
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
|
||||
#endif // CSOAP_HTTP_SERVER_H_
|
||||
#endif // WEBCC_HTTP_SERVER_H_
|
||||
@@ -1,15 +1,15 @@
|
||||
#include "csoap/http_session.h"
|
||||
#include "webcc/http_session.h"
|
||||
|
||||
#include <vector>
|
||||
#if CSOAP_DEBUG_OUTPUT
|
||||
#if WEBCC_DEBUG_OUTPUT
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
#include "boost/asio/write.hpp"
|
||||
|
||||
#include "csoap/http_request_handler.h"
|
||||
#include "webcc/http_request_handler.h"
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
HttpSession::HttpSession(boost::asio::ip::tcp::socket socket,
|
||||
HttpRequestHandler* handler)
|
||||
@@ -90,7 +90,7 @@ void HttpSession::HandleRead(boost::system::error_code ec,
|
||||
// ensured by Asio.
|
||||
void HttpSession::HandleWrite(boost::system::error_code ec,
|
||||
size_t length) {
|
||||
#if CSOAP_DEBUG_OUTPUT
|
||||
#if WEBCC_DEBUG_OUTPUT
|
||||
boost::thread::id thread_id = boost::this_thread::get_id();
|
||||
std::cout << "Response has been sent back (thread: " << thread_id << ")\n";
|
||||
#endif
|
||||
@@ -106,4 +106,4 @@ void HttpSession::HandleWrite(boost::system::error_code ec,
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
@@ -1,17 +1,17 @@
|
||||
#ifndef CSOAP_HTTP_SESSION_H_
|
||||
#define CSOAP_HTTP_SESSION_H_
|
||||
#ifndef WEBCC_HTTP_SESSION_H_
|
||||
#define WEBCC_HTTP_SESSION_H_
|
||||
|
||||
#include <array>
|
||||
#include <memory>
|
||||
|
||||
#include "boost/asio/ip/tcp.hpp" // for ip::tcp::socket
|
||||
|
||||
#include "csoap/common.h"
|
||||
#include "csoap/http_request.h"
|
||||
#include "csoap/http_request_parser.h"
|
||||
#include "csoap/http_response.h"
|
||||
#include "webcc/common.h"
|
||||
#include "webcc/http_request.h"
|
||||
#include "webcc/http_request_parser.h"
|
||||
#include "webcc/http_response.h"
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
class HttpRequestHandler;
|
||||
|
||||
@@ -77,6 +77,6 @@ private:
|
||||
|
||||
typedef std::shared_ptr<HttpSession> HttpSessionPtr;
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
|
||||
#endif // CSOAP_HTTP_SESSION_H_
|
||||
#endif // WEBCC_HTTP_SESSION_H_
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef CSOAP_QUEUE_H_
|
||||
#define CSOAP_QUEUE_H_
|
||||
#ifndef WEBCC_QUEUE_H_
|
||||
#define WEBCC_QUEUE_H_
|
||||
|
||||
// A general message queue.
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "boost/thread/locks.hpp"
|
||||
#include "boost/thread/mutex.hpp"
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
template <typename T>
|
||||
class Queue {
|
||||
@@ -57,6 +57,6 @@ private:
|
||||
boost::condition_variable not_empty_cv_;
|
||||
};
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
|
||||
#endif // CSOAP_QUEUE_H_
|
||||
#endif // WEBCC_QUEUE_H_
|
||||
@@ -1,12 +1,12 @@
|
||||
#include "csoap/rest_server.h"
|
||||
#include "webcc/rest_server.h"
|
||||
|
||||
#if CSOAP_DEBUG_OUTPUT
|
||||
#if WEBCC_DEBUG_OUTPUT
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
#include "csoap/url.h"
|
||||
#include "webcc/url.h"
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -27,7 +27,7 @@ bool RestServiceManager::AddService(RestServicePtr service,
|
||||
return true;
|
||||
|
||||
} catch (std::regex_error& e) {
|
||||
#if CSOAP_DEBUG_OUTPUT
|
||||
#if WEBCC_DEBUG_OUTPUT
|
||||
std::cout << e.what() << std::endl;
|
||||
#endif
|
||||
}
|
||||
@@ -76,7 +76,7 @@ HttpStatus::Enum RestRequestHandler::HandleSession(HttpSessionPtr session) {
|
||||
std::vector<std::string> sub_matches;
|
||||
RestServicePtr service = service_manager_.GetService(url.path(), &sub_matches);
|
||||
if (!service) {
|
||||
#if CSOAP_DEBUG_OUTPUT
|
||||
#if WEBCC_DEBUG_OUTPUT
|
||||
std::cout << "No service matches the URL: " << url.path() << std::endl;
|
||||
#endif
|
||||
session->SetResponseStatus(HttpStatus::kBadRequest);
|
||||
@@ -117,4 +117,4 @@ bool RestServer::RegisterService(RestServicePtr service,
|
||||
return rest_request_handler_->RegisterService(service, url);
|
||||
}
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef CSOAP_REST_SERVER_H_
|
||||
#define CSOAP_REST_SERVER_H_
|
||||
#ifndef WEBCC_REST_SERVER_H_
|
||||
#define WEBCC_REST_SERVER_H_
|
||||
|
||||
// HTTP server handling REST requests.
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "csoap/http_request_handler.h"
|
||||
#include "csoap/http_server.h"
|
||||
#include "csoap/rest_service.h"
|
||||
#include "webcc/http_request_handler.h"
|
||||
#include "webcc/http_server.h"
|
||||
#include "webcc/rest_service.h"
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
class Url;
|
||||
|
||||
@@ -100,6 +100,6 @@ private:
|
||||
RestRequestHandler* rest_request_handler_;
|
||||
};
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
|
||||
#endif // CSOAP_REST_SERVER_H_
|
||||
#endif // WEBCC_REST_SERVER_H_
|
||||
@@ -1,12 +1,12 @@
|
||||
#ifndef CSOAP_REST_SERVICE_H_
|
||||
#define CSOAP_REST_SERVICE_H_
|
||||
#ifndef WEBCC_REST_SERVICE_H_
|
||||
#define WEBCC_REST_SERVICE_H_
|
||||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
#include "csoap/common.h"
|
||||
#include "webcc/common.h"
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
// Base class for your REST service.
|
||||
class RestService {
|
||||
@@ -24,6 +24,6 @@ public:
|
||||
|
||||
typedef std::shared_ptr<RestService> RestServicePtr;
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
|
||||
#endif // CSOAP_REST_SERVICE_H_
|
||||
#endif // WEBCC_REST_SERVICE_H_
|
||||
@@ -1,14 +1,14 @@
|
||||
#include "csoap/soap_client.h"
|
||||
#include "webcc/soap_client.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include "csoap/http_client.h"
|
||||
#include "csoap/http_request.h"
|
||||
#include "csoap/http_response.h"
|
||||
#include "csoap/soap_request.h"
|
||||
#include "csoap/soap_response.h"
|
||||
#include "webcc/http_client.h"
|
||||
#include "webcc/http_request.h"
|
||||
#include "webcc/http_response.h"
|
||||
#include "webcc/soap_request.h"
|
||||
#include "webcc/soap_response.h"
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
Error SoapClient::Call(const std::string& operation,
|
||||
std::vector<Parameter>&& parameters,
|
||||
@@ -68,4 +68,4 @@ Error SoapClient::Call(const std::string& operation,
|
||||
return kNoError;
|
||||
}
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
@@ -1,12 +1,12 @@
|
||||
#ifndef CSOAP_SOAP_CLIENT_H_
|
||||
#define CSOAP_SOAP_CLIENT_H_
|
||||
#ifndef WEBCC_SOAP_CLIENT_H_
|
||||
#define WEBCC_SOAP_CLIENT_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "csoap/common.h"
|
||||
#include "webcc/common.h"
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
// Base class for your SOAP client.
|
||||
// Set URL, host, port, etc. in your sub-class before make the call.
|
||||
@@ -41,6 +41,6 @@ protected:
|
||||
std::string result_name_;
|
||||
};
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
|
||||
#endif // CSOAP_SOAP_CLIENT_H_
|
||||
#endif // WEBCC_SOAP_CLIENT_H_
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "csoap/soap_message.h"
|
||||
#include "webcc/soap_message.h"
|
||||
|
||||
#include <cassert>
|
||||
#include "csoap/xml.h"
|
||||
#include "webcc/xml.h"
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
void SoapMessage::ToXml(std::string* xml_string) {
|
||||
assert(soapenv_ns_.IsValid() &&
|
||||
@@ -51,4 +51,4 @@ bool SoapMessage::FromXml(const std::string& xml_string) {
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifndef CSOAP_SOAP_MESSAGE_H_
|
||||
#define CSOAP_SOAP_MESSAGE_H_
|
||||
#ifndef WEBCC_SOAP_MESSAGE_H_
|
||||
#define WEBCC_SOAP_MESSAGE_H_
|
||||
|
||||
#include <string>
|
||||
#include "pugixml/pugixml.hpp"
|
||||
#include "csoap/common.h"
|
||||
#include "webcc/common.h"
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
// Base class for SOAP request and response.
|
||||
class SoapMessage {
|
||||
@@ -50,6 +50,6 @@ protected:
|
||||
std::string operation_;
|
||||
};
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
|
||||
#endif // CSOAP_SOAP_MESSAGE_H_
|
||||
#endif // WEBCC_SOAP_MESSAGE_H_
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "csoap/soap_request.h"
|
||||
#include "csoap/xml.h"
|
||||
#include "webcc/soap_request.h"
|
||||
#include "webcc/xml.h"
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
void SoapRequest::AddParameter(const Parameter& parameter) {
|
||||
parameters_.push_back(parameter);
|
||||
@@ -54,4 +54,4 @@ bool SoapRequest::FromXmlBody(pugi::xml_node xbody) {
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
@@ -1,10 +1,10 @@
|
||||
#ifndef CSOAP_SOAP_REQUEST_H_
|
||||
#define CSOAP_SOAP_REQUEST_H_
|
||||
#ifndef WEBCC_SOAP_REQUEST_H_
|
||||
#define WEBCC_SOAP_REQUEST_H_
|
||||
|
||||
#include <vector>
|
||||
#include "csoap/soap_message.h"
|
||||
#include "webcc/soap_message.h"
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
// SOAP request.
|
||||
// Used to compose the SOAP request envelope XML which will be sent as the HTTP
|
||||
@@ -26,6 +26,6 @@ private:
|
||||
std::vector<Parameter> parameters_;
|
||||
};
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
|
||||
#endif // CSOAP_SOAP_REQUEST_H_
|
||||
#endif // WEBCC_SOAP_REQUEST_H_
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "csoap/soap_response.h"
|
||||
#include "webcc/soap_response.h"
|
||||
|
||||
#include <cassert>
|
||||
#include "csoap/xml.h"
|
||||
#include "webcc/xml.h"
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
void SoapResponse::ToXmlBody(pugi::xml_node xbody) {
|
||||
std::string rsp_operation = operation_ + "Response";
|
||||
@@ -32,4 +32,4 @@ bool SoapResponse::FromXmlBody(pugi::xml_node xbody) {
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef CSOAP_SOAP_RESPONSE_H_
|
||||
#define CSOAP_SOAP_RESPONSE_H_
|
||||
#ifndef WEBCC_SOAP_RESPONSE_H_
|
||||
#define WEBCC_SOAP_RESPONSE_H_
|
||||
|
||||
#include "csoap/soap_message.h"
|
||||
#include "webcc/soap_message.h"
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
// SOAP response.
|
||||
class SoapResponse : public SoapMessage {
|
||||
@@ -45,6 +45,6 @@ private:
|
||||
std::string result_;
|
||||
};
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
|
||||
#endif // CSOAP_SOAP_RESPONSE_H_
|
||||
#endif // WEBCC_SOAP_RESPONSE_H_
|
||||
@@ -1,13 +1,13 @@
|
||||
#include "csoap/soap_server.h"
|
||||
#include "webcc/soap_server.h"
|
||||
|
||||
#if CSOAP_DEBUG_OUTPUT
|
||||
#if WEBCC_DEBUG_OUTPUT
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
#include "csoap/soap_request.h"
|
||||
#include "csoap/soap_response.h"
|
||||
#include "webcc/soap_request.h"
|
||||
#include "webcc/soap_response.h"
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -55,13 +55,13 @@ SoapServicePtr SoapRequestHandler::GetServiceByUrl(const std::string& url) {
|
||||
UrlServiceMap::const_iterator it = url_service_map_.find(url);
|
||||
|
||||
if (it != url_service_map_.end()) {
|
||||
#if CSOAP_DEBUG_OUTPUT
|
||||
#if WEBCC_DEBUG_OUTPUT
|
||||
std::cout << "Service matches the URL: " << url << std::endl;
|
||||
#endif
|
||||
return it->second;
|
||||
}
|
||||
|
||||
#if CSOAP_DEBUG_OUTPUT
|
||||
#if WEBCC_DEBUG_OUTPUT
|
||||
std::cout << "No service matches the URL: " << url << std::endl;
|
||||
#endif
|
||||
|
||||
@@ -86,4 +86,4 @@ bool SoapServer::RegisterService(SoapServicePtr service,
|
||||
return soap_request_handler_->RegisterService(service, url);
|
||||
}
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
@@ -1,15 +1,15 @@
|
||||
#ifndef CSOAP_SOAP_SERVER_H_
|
||||
#define CSOAP_SOAP_SERVER_H_
|
||||
#ifndef WEBCC_SOAP_SERVER_H_
|
||||
#define WEBCC_SOAP_SERVER_H_
|
||||
|
||||
// HTTP server handling SOAP requests.
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include "csoap/http_request_handler.h"
|
||||
#include "csoap/http_server.h"
|
||||
#include "webcc/http_request_handler.h"
|
||||
#include "webcc/http_server.h"
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -47,6 +47,6 @@ private:
|
||||
SoapRequestHandler* soap_request_handler_;
|
||||
};
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
|
||||
#endif // CSOAP_SOAP_SERVER_H_
|
||||
#endif // WEBCC_SOAP_SERVER_H_
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef CSOAP_SOAP_SERVICE_H_
|
||||
#define CSOAP_SOAP_SERVICE_H_
|
||||
#ifndef WEBCC_SOAP_SERVICE_H_
|
||||
#define WEBCC_SOAP_SERVICE_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
class SoapRequest;
|
||||
class SoapResponse;
|
||||
@@ -21,6 +21,6 @@ public:
|
||||
|
||||
typedef std::shared_ptr<SoapService> SoapServicePtr;
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
|
||||
#endif // CSOAP_SOAP_SERVICE_H_
|
||||
#endif // WEBCC_SOAP_SERVICE_H_
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "csoap/url.h"
|
||||
#include "webcc/url.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
Url::Url(const std::string& str) {
|
||||
std::size_t pos = str.find('?');
|
||||
@@ -73,4 +73,4 @@ Url::Query Url::SplitQuery(const std::string& query) {
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef CSOAP_URL_H_
|
||||
#define CSOAP_URL_H_
|
||||
#ifndef WEBCC_URL_H_
|
||||
#define WEBCC_URL_H_
|
||||
|
||||
// A simplified implementation of URL (or URI).
|
||||
// The URL should start with "/".
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
class Url {
|
||||
public:
|
||||
@@ -48,6 +48,6 @@ private:
|
||||
std::string query_;
|
||||
};
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
|
||||
#endif // CSOAP_URL_H_
|
||||
#endif // WEBCC_URL_H_
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "csoap/utility.h"
|
||||
#include "webcc/utility.h"
|
||||
#include <iostream>
|
||||
|
||||
using tcp = boost::asio::ip::tcp;
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
// Print the resolved endpoints.
|
||||
// NOTE: Endpoint is one word, don't use "end point".
|
||||
@@ -25,4 +25,4 @@ void DumpEndpoints(tcp::resolver::results_type& endpoints) {
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
@@ -1,14 +1,14 @@
|
||||
#ifndef CSOAP_UTILITY_H_
|
||||
#define CSOAP_UTILITY_H_
|
||||
#ifndef WEBCC_UTILITY_H_
|
||||
#define WEBCC_UTILITY_H_
|
||||
|
||||
#include "boost/asio/ip/tcp.hpp"
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
|
||||
// Print the resolved endpoints.
|
||||
// NOTE: Endpoint is one word, don't use "end point".
|
||||
void DumpEndpoints(boost::asio::ip::tcp::resolver::results_type& endpoints);
|
||||
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
|
||||
#endif // CSOAP_UTILITY_H_
|
||||
#endif // WEBCC_UTILITY_H_
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "csoap/xml.h"
|
||||
#include "webcc/xml.h"
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
namespace xml {
|
||||
|
||||
void SplitName(const pugi::xml_node& xnode,
|
||||
@@ -106,4 +106,4 @@ bool PrettyPrintXml(std::ostream& os,
|
||||
}
|
||||
|
||||
} // namespace xml
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
@@ -1,12 +1,12 @@
|
||||
#ifndef CSOAP_XML_H_
|
||||
#define CSOAP_XML_H_
|
||||
#ifndef WEBCC_XML_H_
|
||||
#define WEBCC_XML_H_
|
||||
|
||||
// XML utilities.
|
||||
|
||||
#include <string>
|
||||
#include "pugixml/pugixml.hpp"
|
||||
|
||||
namespace csoap {
|
||||
namespace webcc {
|
||||
namespace xml {
|
||||
|
||||
// Split the node name into namespace prefix and real name.
|
||||
@@ -86,6 +86,6 @@ bool PrettyPrintXml(std::ostream& os,
|
||||
const char* indent = "\t");
|
||||
|
||||
} // namespace xml
|
||||
} // namespace csoap
|
||||
} // namespace webcc
|
||||
|
||||
#endif // CSOAP_XML_H_
|
||||
#endif // WEBCC_XML_H_
|
||||
Reference in New Issue
Block a user