#define SOAP_ADMIN_QUERY_ROUTERS "routers" #define SOAP_ADMIN_QUERY_ROUTER "router" #define SOAP_ADMIN_QUERY_SERVICES "services" static void _soap_admin_send_title(httpd_conn_t* conn, const char* title) { httpd_send_header(conn, 200, "OK"); http_output_stream_write_string(conn->out, "csoap "); http_output_stream_write_string(conn->out, title); http_output_stream_write_string(conn->out, "
"); } static void _soap_admin_list_routers(httpd_conn_t* conn) { SoapRouterNode *node; char buffer[1024]; _soap_admin_send_title(conn, "Available routers"); for (node = head; node; node = node->next) { sprintf(buffer, "
  • %s", node->context, node->context); http_output_stream_write_string(conn->out, buffer); } http_output_stream_write_string(conn->out, ""); } static void _soap_admin_list_services(httpd_conn_t* conn, const char* routername) { SoapRouter *router; SoapServiceNode *node; char buffer[1024]; sprintf(buffer, "Listing Services for Router %s", routername); _soap_admin_send_title(conn, buffer); router = router_find(routername); if (!router) { http_output_stream_write_string(conn->out, "Router not found!"); http_output_stream_write_string(conn->out, ""); return; } node = router->service_head; while (node) { sprintf(buffer, "
  • [%s] (%s)", node->service->urn, node->service->method); http_output_stream_write_string(conn->out, buffer); node = node->next; } http_output_stream_write_string(conn->out, ""); } static void _soap_admin_handle_get(httpd_conn_t * conn, hrequest_t * req) { char *param; if ((param = hpairnode_get_ignore_case(req->query, SOAP_ADMIN_QUERY_ROUTERS))) { _soap_admin_list_routers(conn); } else if ((param = hpairnode_get_ignore_case(req->query, SOAP_ADMIN_QUERY_ROUTER))) { _soap_admin_list_services(conn, param); } else { _soap_admin_send_title(conn, "Welcome to the admin site"); http_output_stream_write_string(conn->out, "
  • Routers "); http_output_stream_write_string(conn->out, ""); } } static void _soap_admin_entry(httpd_conn_t * conn, hrequest_t * req) { if (req->method == HTTP_REQUEST_GET) { _soap_admin_handle_get(conn, req); } else { httpd_send_header(conn, 200, "OK"); http_output_stream_write_string(conn->out, "" "" "" "" "

    Sorry!

    " "
    " "
    POST Service is not implemented now. Use your browser
    " "" ""); } }