Jump to content
boris.nihil

SOAP problem

Recommended Posts

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;

Share this post


Link to post

Hello,

 

There is a lot if information missing in your question. At least you didn't share what the error message you are receiving.

This is only a guess: Are you sure that you need to pass BASE64 data as TBytes to datoteka? My experience is that WSDL import handles Byte -> Base64 encoding for you. In other words, you can try to assign

uses
  System.IOUtils;

...

dat_unl.datoteka := TByteDynArray(TFile.ReadAllBytes(filenameedit1.text));

Above code assumes you have a recent enough Delphi version that has System.IOUtils.TFile.ReadAllBytes()

 

BTW, you really should secure your created objects in a try..finally block.

Share this post


Link to post

thanks on your help,

seems that this was error,

server said it was encrypted so  it couldnt verify signature

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×