Move soap specific definitions to separate files
This commit is contained in:
@@ -70,6 +70,7 @@ if(WEBCC_ENABLE_SOAP)
|
|||||||
set(SOAP_HEADERS
|
set(SOAP_HEADERS
|
||||||
soap_async_client.h
|
soap_async_client.h
|
||||||
soap_client.h
|
soap_client.h
|
||||||
|
soap_globals.h
|
||||||
soap_message.h
|
soap_message.h
|
||||||
soap_parameter.h
|
soap_parameter.h
|
||||||
soap_response.h
|
soap_response.h
|
||||||
@@ -83,6 +84,7 @@ if(WEBCC_ENABLE_SOAP)
|
|||||||
set(SOAP_SOURCES
|
set(SOAP_SOURCES
|
||||||
soap_async_client.cc
|
soap_async_client.cc
|
||||||
soap_client.cc
|
soap_client.cc
|
||||||
|
soap_globals.cc
|
||||||
soap_message.cc
|
soap_message.cc
|
||||||
soap_response.cc
|
soap_response.cc
|
||||||
soap_request.cc
|
soap_request.cc
|
||||||
|
|||||||
+1
-15
@@ -1,7 +1,5 @@
|
|||||||
#include "webcc/globals.h"
|
#include "webcc/globals.h"
|
||||||
|
|
||||||
#include <utility> // for move()
|
|
||||||
|
|
||||||
namespace webcc {
|
namespace webcc {
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
@@ -12,22 +10,10 @@ const std::string kHost = "Host";
|
|||||||
const std::string kContentType = "Content-Type";
|
const std::string kContentType = "Content-Type";
|
||||||
const std::string kContentLength = "Content-Length";
|
const std::string kContentLength = "Content-Length";
|
||||||
|
|
||||||
#ifdef WEBCC_ENABLE_SOAP
|
|
||||||
const std::string kSoapAction = "SOAPAction";
|
|
||||||
#endif // WEBCC_ENABLE_SOAP
|
|
||||||
|
|
||||||
const std::string kAppJsonUtf8 = "application/json; charset=utf-8";
|
const std::string kAppJsonUtf8 = "application/json; charset=utf-8";
|
||||||
|
|
||||||
#ifdef WEBCC_ENABLE_SOAP
|
|
||||||
// According to www.w3.org when placing SOAP messages in HTTP bodies, the HTTP
|
|
||||||
// Content-type header must be chosen as "application/soap+xml" [RFC 3902].
|
|
||||||
// But in practice, many web servers cannot understand it.
|
|
||||||
// See: https://www.w3.org/TR/2007/REC-soap12-part0-20070427/#L26854
|
|
||||||
const std::string kTextXmlUtf8 = "text/xml; charset=utf-8";
|
|
||||||
#endif // WEBCC_ENABLE_SOAP
|
|
||||||
|
|
||||||
const std::string kHttpPort = "80";
|
const std::string kHttpPort = "80";
|
||||||
const std::string kHttpsPort = "443";
|
const std::string kHttpSslPort = "443";
|
||||||
|
|
||||||
const std::string kHttpHead = "HEAD";
|
const std::string kHttpHead = "HEAD";
|
||||||
const std::string kHttpGet = "GET";
|
const std::string kHttpGet = "GET";
|
||||||
|
|||||||
+3
-11
@@ -7,7 +7,7 @@
|
|||||||
// Macros
|
// Macros
|
||||||
|
|
||||||
// Does the compiler support "= default" for move copy constructor and
|
// Does the compiler support "= default" for move copy constructor and
|
||||||
// assignment operator?
|
// move assignment operator?
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#if _MSC_VER <= 1800 // VS 2013
|
#if _MSC_VER <= 1800 // VS 2013
|
||||||
#define WEBCC_DEFAULT_MOVE_COPY_ASSIGN 0
|
#define WEBCC_DEFAULT_MOVE_COPY_ASSIGN 0
|
||||||
@@ -33,7 +33,7 @@ const char* const CRLF = "\r\n";
|
|||||||
// Default buffer size for socket reading.
|
// Default buffer size for socket reading.
|
||||||
const std::size_t kBufferSize = 1024;
|
const std::size_t kBufferSize = 1024;
|
||||||
|
|
||||||
const std::size_t kInvalidLength = static_cast<std::size_t>(-1);
|
const std::size_t kInvalidLength = std::string::npos;
|
||||||
|
|
||||||
// Default timeout for reading response.
|
// Default timeout for reading response.
|
||||||
const int kMaxReadSeconds = 30;
|
const int kMaxReadSeconds = 30;
|
||||||
@@ -42,19 +42,11 @@ extern const std::string kHost;
|
|||||||
extern const std::string kContentType;
|
extern const std::string kContentType;
|
||||||
extern const std::string kContentLength;
|
extern const std::string kContentLength;
|
||||||
|
|
||||||
#ifdef WEBCC_ENABLE_SOAP
|
|
||||||
extern const std::string kSoapAction;
|
|
||||||
#endif // WEBCC_ENABLE_SOAP
|
|
||||||
|
|
||||||
extern const std::string kAppJsonUtf8;
|
extern const std::string kAppJsonUtf8;
|
||||||
|
|
||||||
#ifdef WEBCC_ENABLE_SOAP
|
|
||||||
extern const std::string kTextXmlUtf8;
|
|
||||||
#endif // WEBCC_ENABLE_SOAP
|
|
||||||
|
|
||||||
// Default ports.
|
// Default ports.
|
||||||
extern const std::string kHttpPort;
|
extern const std::string kHttpPort;
|
||||||
extern const std::string kHttpsPort;
|
extern const std::string kHttpSslPort;
|
||||||
|
|
||||||
// HTTP methods (verbs) in string ("HEAD", "GET", etc.).
|
// HTTP methods (verbs) in string ("HEAD", "GET", etc.).
|
||||||
// NOTE: Don't use enum to avoid converting back and forth.
|
// NOTE: Don't use enum to avoid converting back and forth.
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include <utility> // for move()
|
#include <utility> // for move()
|
||||||
|
|
||||||
#include "webcc/http_async_client.h"
|
#include "webcc/http_async_client.h"
|
||||||
|
#include "webcc/soap_globals.h"
|
||||||
#include "webcc/soap_request.h"
|
#include "webcc/soap_request.h"
|
||||||
#include "webcc/soap_response.h"
|
#include "webcc/soap_response.h"
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include <utility> // for move()
|
#include <utility> // for move()
|
||||||
|
|
||||||
#include "webcc/http_client.h"
|
#include "webcc/http_client.h"
|
||||||
|
#include "webcc/soap_globals.h"
|
||||||
#include "webcc/soap_request.h"
|
#include "webcc/soap_request.h"
|
||||||
#include "webcc/soap_response.h"
|
#include "webcc/soap_response.h"
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
#include "webcc/soap_globals.h"
|
||||||
|
|
||||||
|
namespace webcc {
|
||||||
|
|
||||||
|
const std::string kSoapAction = "SOAPAction";
|
||||||
|
|
||||||
|
// According to www.w3.org when placing SOAP messages in HTTP bodies, the HTTP
|
||||||
|
// Content-type header must be chosen as "application/soap+xml" [RFC 3902].
|
||||||
|
// But in practice, many web servers cannot understand it.
|
||||||
|
// See: https://www.w3.org/TR/2007/REC-soap12-part0-20070427/#L26854
|
||||||
|
const std::string kTextXmlUtf8 = "text/xml; charset=utf-8";
|
||||||
|
|
||||||
|
} // namespace webcc
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
#ifndef WEBCC_SOAP_GLOBALS_H_
|
||||||
|
#define WEBCC_SOAP_GLOBALS_H_
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace webcc {
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Constants
|
||||||
|
|
||||||
|
extern const std::string kSoapAction;
|
||||||
|
|
||||||
|
extern const std::string kTextXmlUtf8;
|
||||||
|
|
||||||
|
} // namespace webcc
|
||||||
|
|
||||||
|
#endif // WEBCC_SOAP_GLOBALS_H_
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
#include <utility> // for move()
|
#include <utility> // for move()
|
||||||
|
|
||||||
#include "webcc/logger.h"
|
#include "webcc/logger.h"
|
||||||
|
#include "webcc/soap_globals.h"
|
||||||
#include "webcc/soap_request.h"
|
#include "webcc/soap_request.h"
|
||||||
#include "webcc/soap_response.h"
|
#include "webcc/soap_response.h"
|
||||||
|
|
||||||
@@ -10,7 +11,6 @@ namespace webcc {
|
|||||||
|
|
||||||
bool SoapRequestHandler::Bind(SoapServicePtr service, const std::string& url) {
|
bool SoapRequestHandler::Bind(SoapServicePtr service, const std::string& url) {
|
||||||
assert(service);
|
assert(service);
|
||||||
|
|
||||||
url_service_map_[url] = service;
|
url_service_map_[url] = service;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user