Add SoapAsyncClient.
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
|
||||
#include "json/json.h"
|
||||
|
||||
#include "webcc/rest_async_client.h"
|
||||
#include "webcc/logger.h"
|
||||
#include "webcc/rest_async_client.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
@@ -50,7 +50,7 @@ class BookListClient {
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
class BookDetailClient {
|
||||
public:
|
||||
public:
|
||||
BookDetailClient(boost::asio::io_context& io_context,
|
||||
const std::string& host, const std::string& port)
|
||||
: rest_client_(io_context, host, port) {
|
||||
@@ -83,7 +83,7 @@ public:
|
||||
rest_client_.Delete("/book/" + id, handler);
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
webcc::RestAsyncClient rest_client_;
|
||||
};
|
||||
|
||||
@@ -112,8 +112,7 @@ int main(int argc, char* argv[]) {
|
||||
BookDetailClient detail_client(io_context, host, port);
|
||||
|
||||
// Response handler.
|
||||
auto handler = [](std::shared_ptr<webcc::HttpResponse> response,
|
||||
webcc::Error error,
|
||||
auto handler = [](webcc::HttpResponsePtr response, webcc::Error error,
|
||||
bool timed_out) {
|
||||
if (error == webcc::kNoError) {
|
||||
std::cout << response->content() << std::endl;
|
||||
|
||||
@@ -23,7 +23,8 @@ BookClient::BookClient(const std::string& host, const std::string& port)
|
||||
soap_client_.set_indent_str(" ");
|
||||
}
|
||||
|
||||
bool BookClient::CreateBook(const std::string& title, double price, std::string* id) {
|
||||
bool BookClient::CreateBook(const std::string& title, double price,
|
||||
std::string* id) {
|
||||
PrintSeparateLine();
|
||||
std::cout << "CreateBook: " << title << ", " << price << std::endl;
|
||||
|
||||
@@ -91,7 +92,8 @@ bool BookClient::Call0(const std::string& operation, std::string* result_str) {
|
||||
}
|
||||
|
||||
|
||||
bool BookClient::Call1(const std::string& operation, webcc::SoapParameter&& parameter,
|
||||
bool BookClient::Call1(const std::string& operation,
|
||||
webcc::SoapParameter&& parameter,
|
||||
std::string* result_str) {
|
||||
std::vector<webcc::SoapParameter> parameters{
|
||||
{ std::move(parameter) }
|
||||
|
||||
Reference in New Issue
Block a user