Here is my code.
TIdHTTP *IdHTTP1;
std::ostringstream oss;
oss << “<?xml version=\\"1.0\\" encoding=\\"utf-8\\"?>”;
oss << “<soap:Envelope xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:xsd=\“http://www.w3.org/2001/XMLSchema\” xmlns:soap=\“http://schemas.xmlsoap.org/soap/envelope/\”>”;
oss << “soap:Body”;
oss << “<Login xmlns=\“http://videoos.net/2/XProtectCSServerCommand\”>”;
oss << “”;
oss << AnsiString(System::Sysutils::GUIDToString(tMyGUID)).c_str();
oss << “”;
oss << “”;
oss << “”;
oss << “</soap:Body>”;
oss << “</soap:Envelope>”;
std::string sSoap(oss.str());
oss.str(“”);
oss << “http://” <<sServerIP << “:80/ManagementServer/ServerCommandService.svc”;
std::string sURL(oss.str());
oss.str(“”);
oss << “http://videoos.net/2/XProtectCSServerCommand/Login”;
std::string sSoapAction(oss.str());
oss.str(“”);
oss << “Basic VXNlcjpQYSQkdzByZA==”;
std::string sAutor(oss.str());
oss.str(“”);
IdHTTP1->Request->Accept = “text/xml”;
IdHTTP1->Request->Host = sServerIP.c_str();
IdHTTP1->Request->AcceptEncoding = “gzip, deflate”;
IdHTTP1->Request->BasicAuthentication = true;
IdHTTP1->Request->ContentEncoding = “utf-8”; //in test
IdHTTP1->Request->ContentType = “application/soap+xml; charset=utf-8”; //“text/xml; charset=utf-8”;
IdHTTP1->Request->CharSet = “utf-8”; // //in test
IdHTTP1->Request->ContentLength = sSoap.length();
IdHTTP1->Request->Method = “POST”;
IdHTTP1->Request->Username = sUsername.c_str();
IdHTTP1->Request->Password = sPassword.c_str();
IdHTTP1->Request->UserAgent = “IndyTest”;
IdHTTP1->Request->CustomHeaders->AddValue(“SOAPAction”, sSoapAction.c_str());
TStringStream *pReq = new TStringStream(UnicodeString(sSoap.c_str()), TEncoding::UTF8, true);
TStringStream *pResp = new TStringStream();
IdHTTP1->Post(sURL.c_str(), pReq, pResp);
IdHTTP1->Request->CustomHeaders->Clear();
oss << IdHTTP1->ResponseCode << “\”" << AnsiString(IdHTTP1->Response->ResponseText).c_str() << “\”";