bool XmlRequest::executeWithTextResponse()

in src/dxapi/native/tickdb/http/xml/xml_request.cpp [391:433]


bool XmlRequest::executeWithTextResponse(string &response)
{
    std::string request = getRequest();

    if (noRequestNeeded_) {
        return true;
    }

#if defined(_DEBUG) && DBG_LOG_ENABLED == 1 && XML_LOG_LEVEL >= 2
    dbg_log_xml(std::string(name_).c_str(), request.c_str());
#endif
    //DBGLOG("db = " FMT_HEX64, &db_);
    //throw XmlErrorResponseException(httpResponseCode, responseBody);sdas das

    int httpResult = db_.executeTbPostRequest(response, request, name_, allowUnopenedDb);
    if (!HttpSuccess(httpResult)) {
        string msg("Unable to execute XML HTTP request: ");

        msg.append(response);
        string unescaped;
        XmlParse::unescape(unescaped, response);
        response = move(unescaped);

        if (noException) {
            // TODO: Shouldn't log this always?
            DBGLOGERR((std::string*)NULL, "%s", msg.c_str());
            return false;
        }

#if DBG_LOG_ENABLED == 1 && XML_LOG_LEVEL >= 1
        dbg_log_xml("ERROR !!!!", " ");
        dbg_log_xml(string(name_).append(" request").c_str(), request.c_str());
        dbg_log_xml(string(name_).append(" response(error)").c_str(), response.c_str());
#endif
        DBGLOGERR((std::string*)NULL, "%s", msg.c_str());
        throw XmlErrorResponseException(httpResult, response);
    }

#if defined(_DEBUG) && DBG_LOG_ENABLED == 1 && XML_LOG_LEVEL >= 2
    dbg_log_xml(string(name_).append(" response").c_str(), response.c_str());
#endif
    return true;
}