EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Correct use of HttpsClient.Post

Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.
#27316
Posted: 11/24/2013 00:59:53
by Jeff Newlin (Standard support level)
Joined: 12/26/2010
Posts: 19

Hello again,

I have been given the task of providing the following functionality from a delphi program - I'm planning to do it with HttpsClient.Post

This is my "example" I am following :

<form method="post" action="https://www.sample.com/RegisterIt"
enctype="multipart/form-data">

Email<input name="email" type="text" placeholder="email">

SSNO<input name="ssno" type="text" placeholder="ssno">

Clinic ID<input name="clinic_id" type="text" placeholder="clinic_id">

Token<input name="token" type="text" placeholder="token">

Upload XD File <input type="file" name="xd_file" id="xd_file" />
<input type="submit" value="Submit Form"/>

</form>


To provide this functionality, this is what I'm doing in my delphi program :

Var
SL: TStringList;

SL := TStringList.Create;
SL.Add('token=' + TokenString);
SL.Add('email=' + EmailString) ;
SL.Add('ssno=' + SSNString ) ;
SL.Add('clinic_id=' + ClinicIDString ) ;

HttpsClient.Post(URL, SL, 'xd_file', 'xd.xml');

Is this the proper use of the HttpsClient ? it seems to not be working and I want to know if I have the correct general idea.

Thanks as always!
Jeff
#27328
Posted: 11/24/2013 10:24:26
by Ken Ivanov (EldoS Corp.)

Hello Jeff,

Thank you for getting in touch with us.

Your code is missing the FileStream parameter. Please note that it's your responsibility to provide the contents of the file, - either by opening a physical file with TFileStream class or by writing the in-memory content to a TElMemoryStream object. In all other aspects your code looks correct.
#27346
Posted: 11/25/2013 02:15:12
by Jeff Newlin (Standard support level)
Joined: 12/26/2010
Posts: 19

Thank you very much for your help.

I added the filestream parameter. I am checking the SendData event of the Https Client and I noticed that it seems to send my file data prior to the request paramaters in values. So in my above example I observe this during the SendData event :

xd_File Data
token
email
ssno
clinic_id


and I'm wondering if it can be made to send these data in this order

token
email
ssno
clinic_id
xd_File Data


So in short - can the file data be sent last instead of first?


I'm not positive this is my problem but I have been instructed that this is my "signature" for this request

Signature:
RegisterIt(token,email,ssno,clinic_id,xd_file)
Return type: JSON

I just noticed that the file data came out first and I'm wondering if that might be my problem.


Thank you!
Jeff
#27348
Posted: 11/25/2013 02:23:50
by Vsevolod Ievgiienko (EldoS Corp.)

Hello.

Quote
I just noticed that the file data came out first and I'm wondering if that might be my problem.

This should not be a problem.

Quote
it seems to not be working and I want to know if I have the correct general idea.

Could you clarify this. Do you get any exception or TElHTTPSClient.Post return any error code?
#27349
Posted: 11/25/2013 02:25:25
by Ken Ivanov (EldoS Corp.)

Jeff,

Could you please let us know the exact problems you are having with the request (is some exception, an invalid HTTP code or a page describing the error returned)?
#27351
Posted: 11/25/2013 02:46:45
by Jeff Newlin (Standard support level)
Joined: 12/26/2010
Posts: 19

I'm sorry I should have checked the "post" return code. The code is 500 so it looks like that is Internal Server Error. hopefully the receiving end of this request can give me a little advice. Thanks for your help!
Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.

Reply

Statistics

Topic viewed 619 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!