Jump to content

boris.nihil

Members
  • Content Count

    32
  • Joined

  • Last visited

Everything posted by boris.nihil

  1. boris.nihil

    SOAP problem

    Hello Can somebody see what is error in here... I imported WSDL file, trying to upload 2 files,one TXT and PDF, TXT is previously signed... I encode them in base64 and translate to TByteDynArray ,but server doesn't accept them... ------------------------------------- WSDL function function uploadSKZZRacun(const parameters: UploadSKZZRacunRequest): UploadResponse; stdcall; ------------------------------ UploadSKZZRacunRequest = class(TRemotable) ... published property pdf: Datoteka read Fpdf write Fpdf; property unl: Datoteka read Funl write Funl; ---------------------------------- Datoteka = class(TRemotable) private Fnaziv: string; Fdatoteka: TByteDynArray; published property naziv: string read Fnaziv write Fnaziv; property datoteka: TByteDynArray read Fdatoteka write Fdatoteka; end; -------------------------- UploadResponse = (SUCCESS); ---------------------- var zahtjev:UploadSKZZRacunRequest; rezultat:UploadResponse; buffer:String; binaryData: TByteDynArray; begin zahtjev := UploadSKZZRacunRequest.create; dat_unl := datoteka.create; dat_unl.name := ExtractFileName(filenameedit1.text);// '034_Rn_9308930850005.Z25.p7s'; buffer := EncodeFileToBase64(dat_unl.name ); SetLength(binaryData, Length(buffer) * sizeof(Char)); if Length(buffer) > 0 then Move(buffer[1], binaryData[0], Length(buffer) * sizeof(Char)); dat_unl.datoteka := binaryData; rezultat := (HTTPRIO1 as CezihWs).uploadSKZZRacun(zahtjev); zahtjev.free;
  2. boris.nihil

    SOAP problem

    thanks on your help, seems that this was error, server said it was encrypted so it couldnt verify signature
  3. boris.nihil

    digital sign pdf

    hi, does anybody uses securebridge from DEVART to sign a pdf, i dont know is it good code: var signed, bajtovi: TBytes; fajl:tfile; ScMemoryStorage1.ImportFromPKCS12('c:\_Projekti\028.pfx', 'Pero412'); bajtovi := fajl.readallbytes('c:\_Projekti\Svjedodzba.PDF'); signed:= ScMemoryStorage1.Certificates.Certificates[0].Sign(bajtovi,haSHA1,pmPKCS1); SaveBytesToFile(bajtovi,'c:\_Projekti\Svjedodzba_signed.PDF');
  4. boris.nihil

    openssl dll problem

    hello is it possible to have 2 or more version of the same dll in application? (ssleay32.dll and libeay32.dll) i have some old unit whitch uses openssl dlls from 2005 and i am sending emails with Indy which required openssl dlls from 2019... i have set a path for Indy dlls at the program start, initialisation, sslpath... when i use loadlibrary('') for this 2005. year dll, i cannot send emails enymore with indy, it say "the ordinal 3844 could not be located in the dynamic link library"
  5. boris.nihil

    openssl dll problem

    i think this will not work... But why application cant free dll previously loaded with Handle := LoadLibrary(pchar(ExtractFilePath(Application.ExeName)+ 'ssl_old\DLL-2005\libeay32.dll')); with freelybrary FreeLibrary(Handle); Handle := 0;
  6. boris.nihil

    OpenSSL question

    hello,i am not familiar with ssl much.. I have some old delphi code for sending soap messages ,it uses oopenssl: "Delphi import unit for OpenSSL libeay, version 0.7m, 2010-11-05" it works only with dlls from 2005 year (ssleay32.dll and libeay32.dll) why this EXE dont work with some newer dlls, from 2019 for example...
  7. boris.nihil

    OpenSSL question

    where can i find needed delphi units for this new openssl ? (libeay32.pas,libexslt.pas,libxml2.pas,libxmlsec.pas...)
  8. boris.nihil

    Indyclient help

    Hello I have question about indy,sending and receiving messages from-to ECR-POS(Ingenico), am i doing it right ? ------send to POS request for Card paying IdTCPClient1.IOHandler.InputBuffer.Clear; IdTCPClient1.IOHandler.Write(buff); Timer4.Enabled := true; ---------on timer4 try if IdTCPClient1.IOHandler.InputBufferIsEmpty then begin if IdTCPClient1.IOHandler.CheckForDataOnSource(1000) then begin bajt := IdTCPClient1.IOHandler.ReadByte; bajt := IdTCPClient1.IOHandler.ReadByte; IdTCPClient1.IOHandler.ReadBytes(Buffer,bajt - 1,true); s := ''; for i := 0 to bajt - 1 do s := s + chr(buffer); Memo1.Lines.Add(s); Timer4.Enabled := false; end else IdTCPClient1.IOHandler.InputBuffer.Clear end else IdTCPClient1.IOHandler.InputBuffer.Clear; except end;
  9. boris.nihil

    Indyclient help

    thanks a lot for you answers
  10. boris.nihil

    Indyclient help

    compiler says error,no such function this code works... ------------------- bajt := data1.IdTCPClient1.IOHandler.ReadByte; bajt1 := data1.IdTCPClient1.IOHandler.ReadByte; bajt2 := bajt * $10 + bajt1; data1.IdTCPClient1.IOHandler.ReadBytes(Buffer,bajt2,false); s := ''; for i := 0 to bajt2 - 1 do s := s + inttohex(buffer,2); ---------------------------- i need a hex, I explode it with 1C delimeter, its easy to handle.. What AApend parameter means, true or false, what to use in: data1.IdTCPClient1.IOHandler.ReadBytes(Buffer,bajt2,false); ?
  11. boris.nihil

    Indyclient help

    thanks Datagram protocol Datagram protocol is used over stream-oriented protocols (TCP) to provide information to the receiver of the length of the data being sent. Datagram protocol forms a packet by adding a header to the payload. Datagram protocol header contains the length of the payload encoded in two bytes. Header Format Header consists of two bytes with the most significant byte first: Byte Value 1 Message length/256 2 Message lengt%256 --------------------------------------- Length of data Header Packet 7 0x00 0x07 0x00 0x07 B1 B2 B3 … B7 17 0x00 0x11 0x00 0x11 B1 B2 B3 … B17 135 0x00 0x87 0x00 0x87 B1 B2 B3 … B135 i need timer (put on 2000 ms), becouse i wait for customer to insert credit card on POS terminal, then POS will sent some message to me,starting with 10xxxxxxx first 2 bytes is size of packet,i think first one is always zero ? thanks,i will try it
  12. boris.nihil

    pdf417

    Does anybody have experience with 2d barcode, TurboPower SysTools, component StPDF417Barcode... I can't add StPDF417Barcode1.code = '...' witch contains some local letters (ŠĐČĆŽš), it says "Range check error"... virm_grad ,virm_adresa ,virm_naziv:string; virm_naziv := utf8encode('dsdddddd'); virm_adresa := utf8encode('ŠĐŠĐČĆĆČĆČ'); virm_grad := utf8encode('špšpUIZUZUZ'); StPDF417Barcode1.Code := 'HRVHUB30' + #13#10 + 'EUR' + #13#10 + virm_naziv + #10 + virm_adresa + #10 + virm_grad + #10;
  13. boris.nihil

    pdf417

    Thanks Brian, by putting Datamode to binary solved the problem
  14. boris.nihil

    pdf417

    in instructions PDF, they say: Simbol UTF-8 Hex Č C4 8C č C4 8D Ć C4 86 ć C4 87 Đ C4 90 ------------------------- how to use it in delphi code ?
  15. hi i need to send some HEX to POS terminal, amount of money, and POS will then check if credit card if valid and send me some answers..like this: (<STX><STX>message<ETX><LRC>) ECR-->POS: <STX><STX>303030303030303030303031303030<FS>31303030<FS><FS>2B30<FS>313931<FS><FS><FS><FS><FS><FS><FS><FS><FS><FS><FS>3030<FS>31<FF><FS><FS><FS><FS><FS><FS><FS><FS><ETX>2C POS-->ECR: <ACK> POS-->ECR: <STX>32303030303030305542414349204B415254494355<ETX>2E ECR-->POS: <ACK> ------------------------------------------------------------------- I try with Indy IdTCPClient1 but I dont receive nothing from POS. Am i sending wrong code or I dont know how to receive answer ? They say i need do send HEX string.. So i translate this HEX: <STX><STX>303030303030303030303031303030<FS>31303030<FS><FS>2B30<FS>313931<FS><FS><FS><FS><FS><FS><FS><FS><FS><FS><FS>3030<FS>31<FF><FS><FS><FS><FS><FS><FS><FS><FS><ETX>2C to 02023030303030303030303030313030301C313030301C1C2B301C3139311C1C1C1C1C1C1C1C1C1C1C30301C310C1C1C1C1C1C1C1C1C032C and send it like IdTCPClient1.IOHandler.WriteLn(edit7.Text, IndyTextEncoding_OSDefault); timer1.Enabled := true; This is how i wait for server ansver: procedure TForm1.Timer1Timer(Sender: TObject); var receivedtext:string; begin with IdTCPClient1 do begin try if IOHandler.InputBufferIsEmpty then begin IOHandler.CheckForDataOnSource(0); IOHandler.CheckForDisconnect; if IOHandler.InputBufferIsEmpty then Exit; end; receivedtext := IOHandler.ReadLn; except Timer1.Enabled := False; Exit; end; if receivedtext <> '' then ShowMessage(receivedtext); end; end;
  16. boris.nihil

    Parse Json

    all thanks goes to Remy
  17. boris.nihil

    Parse Json

    function GetValue(JsonObject: TJSONObject; const PairName: string): TJSONValue; var JsonPair: TJSONPair; begin JsonPair := JsonObject.Get(PairName); if JsonPair = nil then raise Exception.Create('Pair "' + PairName + '" not found'); Result := JsonPair.JsonValue; end; function GetObject(JsonObject: TJSONObject; const PairName: string): TJSONObject; begin Result := GetValue(JsonObject, PairName) as TJSONObject; end;
  18. boris.nihil

    Parse Json

    var JsonValueArr,JsonValue: TJSONValue; JsonObject: TJSONObject; jasonArr: TJSONArray; begin JsonValue := TJSONObject.ParseJSONValue(memoRequest.Lines.Text); if JsonValue = nil then begin ShowMessage('Error'); end else begin JsonObject := JsonValue as TJSONObject; JsonObject := GetObject(JsonObject, 'forretningsadresse'); jasonArr := GetValue(JsonObject, 'adresse') as TJSONArray; for JsonValueArr in jasonArr do begin showmessage(JsonValueArr.Value); end; end; end;
  19. boris.nihil

    New to JSON

    i can't figure out how to parse json answer from some invoice company I use Delphi XE4, DBXJSON... How to get Jsonpairs insde nested objects... Example: { "messageAck": { "messageID": "Middleware_002", "messageAckID": "8f50dd66-a77f-45ec-9049-0faadb69ff43", "messageType": 9002, "ackStatus": "ACCEPTED", "ackStatusCode": 10, "ackStatusText": "Poruka zaprimljena!" }, "b2GOutgoingInvoiceEnvelope": { "b2GOutgoingInvoiceProcessing": { "correctB2GOutgoingInvoice": {"supplierInvoiceID": "dokument1","invoiceID": 84001,"invoiceTimestamp": "03-03-2020"}, "incorrectB2GOutgoingInvoice": null}} }
  20. boris.nihil

    New to JSON

    you are right, thanks for you help and your time
  21. boris.nihil

    New to JSON

    this works ok.. var jasonArr:TJSONArray; par: TJSONPair; i: Integer; LItem:TJSONValue; JsonValueArr : TJSONValue; testValue: TJSONValue; begin jasonArr := GetValue(JsonObject, 'documentStatus') as TJSONArray; for JsonValueArr in jasonArr do begin for LItem in TJSONArray(JsonValueArr) do begin if TJSONPair(LItem).JsonString.Value = 'statusCode' then odgovorFinaStatus.b2gStatus := TJSONPair(LItem).JsonValue.Value else if TJSONPair(LItem).JsonString.Value = 'statusText' then odgovorFinaStatus.b2gStatusTekst := TJSONPair(LItem).JsonValue.Value else if TJSONPair(LItem).JsonString.Value = 'statusTimestamp' then odgovorFinaStatus.b2gStatusVrijeme := TJSONPair(LItem).JsonValue.Value else if TJSONPair(LItem).JsonString.Value = 'note' then odgovorFinaStatus.b2gStatusNapomena := TJSONPair(LItem).JsonValue.Value else if TJSONPair(LItem).JsonString.Value = 'partialAmount' then begin try odgovorFinaStatus.b2gDjelIzn := StrToFloat(TJSONPair(LItem).JsonValue.Value); except odgovorFinaStatus.b2gDjelIzn := 0 end; end;
  22. boris.nihil

    New to JSON

    when i write for LItem in TJSONObject(JsonValueArr) do it says: [dcc32 Error] Unit1.pas(568): E2010 Incompatible types: 'TJSONValue' and 'TJSONPair'
  23. boris.nihil

    New to JSON

    something like this, seems to work: jasonArr := GetValue(JsonObject, 'documentStatus') as TJSONArray; for JsonValueArr in jasonArr do begin for LItem in TJSONArray(JsonValueArr) do begin ShowMessage(TJSONPair(LItem).JsonString.Value + '/' + TJSONPair(LItem).JsonValue.Value); end; end;
  24. boris.nihil

    New to JSON

    it works fine,thanks but now i have some array inside object how to acces this documentStatus element ? { "messageAck": { "messageID": "Middleware_002", "messageAckID": "a98d281b-9608-4b25-be03-7be0403916dd", "messageType": 9012, "ackStatus": "ACCEPTED", "ackStatusCode": 10, "ackStatusText": "Message received!" }, "b2GOutgoingInvoiceStatus": { "supplierID": "9934:86167814130", "additionalSupplierID": null, "invoiceID": 83703, "supplierInvoiceID": "IR-19-1766-1-1", "invoiceTimestamp": "28-02-2020", "documentStatus": [ { "statusCode": "RECEIVED", "statusText": "Received", "statusTimestamp": "28-02-2020", "note": null, "partialAmount": null} ] } }
  25. boris.nihil

    New to JSON

    uh, it's very complicated.. Thank a lot on your effort
×