23 #include "webview_reqproc.h"
24 #include <core/exception.h>
25 #include <logging/logger.h>
26 #include <webview/error_reply.h>
27 #include <webview_msgs/ProcessRequest.h>
29 using namespace fawkes;
50 std::string &srv_name)
54 __srv_name = srv_name;
55 __logcomp = std::string(
"ROSWebviewRP[") + srv_name +
"]";
57 __srv_client = nh->serviceClient<webview_msgs::ProcessRequest>(srv_name);
63 __srv_client.shutdown();
70 const char *upload_data,
71 size_t *upload_data_size,
74 logger->
log_debug(__logcomp.c_str(),
"Processing %s", url);
76 webview_msgs::ProcessRequest srv;
77 srv.request.url = url;
78 srv.request.method = method;
79 srv.request.version = version;
80 srv.request.upload_data =
81 std::vector<uint8_t>((uint8_t *)upload_data,
82 (uint8_t *)&upload_data[*upload_data_size]);
84 if (! __srv_client.exists()) {
86 "Service %s is no longer available",
89 }
else if (__srv_client.call(srv)) {
90 if (srv.response.code == WebReply::HTTP_OK) {
92 if (srv.response.wrap_in_page) {
101 std::vector<std::string>::iterator h;
102 for (h = srv.response.headers.begin(); h != srv.response.headers.end(); ++h)
114 "Execution of service %s failed: %s",
116 srv.response.error.c_str());
120 "Execution of service %s failed",