Jump to content

amit

Members
  • Content Count

    20
  • Joined

  • Last visited

Community Reputation

3 Neutral
  1. I still be able to download if I had login.
  2. HI Remy, I wonder why it can be used on my development PC but not on the target PC. I got this error on the Target PC - EIdOSSLCouldNotLoadSSLLibrary: Could not load SSL library. I knew it concerned to SSL libeay32.dll and ssleay32.dll. I copied it to the application folder but it still have this error. Can you suggest what should I do?
  3. amit

    TIdHTTP to TNetHTTPRequest

    Dear Remy, Are these CredentialStorage and AuthEvent limited to only Basic Authentication? Is there any processing different among using CustHeaders and the methods you suggested? And many thanks for your suggestion.
  4. Sample code for someone who need to work on JSON. JsonDemo.rar
  5. amit

    TIdHTTP to TNetHTTPRequest

    Just try and let me know if it works. uses ..., System.NetEncoding, ... ... var Base64: TBase64Encoding; httpClient: THttpClient; ... begin ... httpClient.ContentType:='application/xml'; Base64 := TBase64Encoding.Create; httpClient.CustHeaders.add('Authentication','Basic ' + Base64.Encode('user:password')); Base64.Free; httpClient.CustHeaders.Add('OrganisationId', 'your dm.Company'); httpClient.CustHeaders.Add('Accept', 'application/xml'); httpClient.Post('your URL',xmlData); ... end;
  6. Thank you Remy. I had created the indy version before you reply. in my version, I did not include IdSSLOpenSSL unit in uses clause and no SSL as shown in your code. However, it works. I just wonder if I should use SSL as you suggested. I'm not sure if I did not use it, it may have problem sometime or not.
  7. Now I knew how to use TIdHttp and THttpClient instead of TRESTClient. For Indy TidHttp, use TIdMultiPartFormDataStream for adding all Parameters. For THttpClient, use TMultipartFormData for adding all Parameters Uwe Raabe, Thank for all helps.
  8. I wonder what is the equivalent command for TIdHTTP and THTTPClient if they were used instead of TRESTClient. request.AddParameter('message', 'abcTest', pkREQUESTBODY); request.AddParameter('stickerPackageId', '1', pkREQUESTBODY); request.AddParameter('stickerId', '113', pkREQUESTBODY); request.AddParameter('imageFile', 'D:\mypic.jpg', pkFILE);
  9. I want to use TIdHttp or THTTPClient to send this following curl command. curl -X POST https://notify-api.line.me/api/notify -H "Authorization: Bearer U4314taadsffhjjjjykllFVissffdfssdfsdfsgfgz" -F "message=abcTest" -F "stickerPackageId=1" -F "stickerId=113" -F "imageFile=@D:/mypic.jpg" Could you please help me convert this command to Delphi Code using indyhttp or THttpClient?
  10. I limit the data send to server at 25 records at a time. Anyway I wonder how I can make sure that the server can successfully insert the whole data on the database without returning the successfully inserted ID. if I just check only the http status 200 returned, I knew only that the server successfully received the whole json string but it is not guarantee that the whole data are inserted successfully on the database. In my server code, I return just only the successfully inserted record IDs, the problem ones will not be returned. The client will update the sentflag on any records that ID are in the RetIDList. So on the next data send phase, the problem ones can be sent again. Is there any other way to check whether there is no problem at all on the server side? Please suggest. Thank you. Oh another thing the IDs that send to the server in Json string is the ID of the records in database's table in the client PC and it will never be inserted to the Server's database for any reference. They will be used for server to reply back to the client if they are inserted succesfully. Client will mark those records by setting sentflag so no need to resend them.
  11. I want to use them to construct the SQL to update record flag in SQL table. The Bracket in the RetIDList will be romoved and finally the RetIDList will be '1,2,3,4,5'. Then I will create Update SQL as qry.SQL.clear; qry.SQL.add('Update Table1 Set Flag=0 where ID in ('+RetIDList+');'); qry.ExecSql; Anyway, if you can point me how to access IDLIST as an array of integer it will be OK. I can generate the SQL from that array.
  12. I try to retreive the data from JSON string that return from the server. Here is the JSON String {"RESULT":200, "IDLIST":[1,2,3,4,5]} I wrote delphi code as shown below to get the Array but it return empty string. var jso: TJsonObject; jsv: TJsonValue; s, RetResult, RetIDList: string; begin s := '{"RESULT":200, "IDLIST":[1,2,3,4,5]}'; jso := TJsonObject.ParseJSONValue(s) as TJsonObject; jsv := jso.GetValue('RESULT'); if jsv<>nil then RetResult := jsv.Value else RetResult := ''; // <-- this is OK. RetResult will be '200'. jsv := jso.GetValue('IDLIST'); if jsv<>nil then RetIDList := jsv.Value else RetIDList := ''; // <---I alway get the empty string for RetIDList. end; I try to use jsonpair instead with the code below. I will get the array string. var jso: TJsonObject; jsv: TJsonValue; jsp: TJsonpair; s, RetResult, RetIDList: string; begin s := '{"RESULT":200, "IDLIST":[1,2,3,4,5]}'; jso := TJsonObject.ParseJSONValue(s) as TJsonObject; jsv := jso.GetValue('RESULT'); if jsv<>nil then RetResult := jsv.Value else RetResult := ''; // <-- this is OK. RetResult will be '200'. for iJsonPair in jso do begin if (iJsonPair.JsonString.value = 'IDLIST') then begin RetIDList := iJsonPair.JsonValue.ToJson; // <-- This is OK. RetIDList wlll be '[1,2,3,4,5]'. // RetIDList := iJsonPair.JsonValue.Value; // <-- if I use this line instead I got empty string; break; end; end; end; Why? What is the different between iJsonPair.JsonValue.ToJson and iJsonPair.JsonValue.Value ?
  13. I had created the report in Quality Central already ( RSP-32335 ). I also attached your Project1.dpr with the report.
  14. Thank you all for trying to help. I finally found that the monotype or monospace font that use in Delphi editor is not suitable for displaying Thai Language. Even it can display Thai but it display incorrectly. Delphi Editor should be upgrade to make it capable to use non monotype or monospace font. You can see the picture that how it display Thai incorrectly compare to the correct one. I hope one day Embarcadero will make a better editor to display Thai language correctly soon.
×