Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
post xml data with XMLHttpRequest
#4
I used this code , it's the execute func of the content handler:

bool __fastcall TContentPP ::Execute(Iw::Http::Request::THttpRequest* aRequest, Iw::Http::Reply::THttpReply* aReply, const System::UnicodeString aPathname, Iwapplication::TIWApplication* aSession, System::Classes::TStrings* aParams)
{
bool          rc = true;
UnicodeString  empf;
THttpFile    *xFile;
TFileStream  *fs;
TStringStream *js;

if (aRequest->Files->Count > 0)
  {
    xFile = aRequest->Files->Items[0];
    fs = new TFileStream(xFile->TempPathName, fmOpenRead | fmShareDenyNone);
    js = new TStringStream;
   

    js->CopyFrom(fs, 0);
    empf = js->DataString;
   
    delete fs;
    delete js;
    rc = true;
  }
 
if (aReply)
  {
  aReply->ContentType = MIME_JSON;
  aReply->Code = 200;
  aReply->CodeText = "OK";
  aReply->WriteString("{\"status\":\"success\"}"); // R?ckgabe eines JSON-Objekts 
  }
 
 
return rc; 
}
//---------------------------------------------------------------------------
the string "empf" hold the json-reply I wait for.
Reply


Messages In This Thread
post xml data with XMLHttpRequest - by JuergenS - 08-23-2024, 03:26 AM
RE: post xml data with XMLHttpRequest - by joergb - 08-23-2024, 10:36 PM
RE: post xml data with XMLHttpRequest - by joergb - 08-25-2024, 03:16 PM
RE: post xml data with XMLHttpRequest - by joergb - 08-26-2024, 02:57 PM

Forum Jump:


Users browsing this thread: 4 Guest(s)