Demo files.

Discussion of open issues, suggestions and bugs regarding network security and data protection solution - SecureBridge
Post Reply
bme79
Posts: 6
Joined: Thu 27 Jun 2013 22:58

Demo files.

Post by bme79 » Thu 27 Jun 2013 23:00

Hi,

I have installed Trial version of SecureBridge for Delphi7 but I can not find any folder with demo files. Could you please tell me where can I find it?

Regards,
Max

DemetrionQ
Devart Team
Posts: 271
Joined: Wed 23 Jan 2013 11:21

Re: Demo files.

Post by DemetrionQ » Mon 01 Jul 2013 10:26

Hello.

Demo projects are installed together with SecureBridge if you check the appropriate option on the SecureBridge installation. Demo projects are located in the Demos directory that you specify on the SecureBridge installation (e.g., C:\Users\Public\Documents\Devart\SecureBridge for Delphi 7\Demos).

bme79
Posts: 6
Joined: Thu 27 Jun 2013 22:58

Re: Demo files.

Post by bme79 » Mon 01 Jul 2013 19:40

Thank you,

I've found it.

Max

bme79
Posts: 6
Joined: Thu 27 Jun 2013 22:58

Re: Demo files.

Post by bme79 » Mon 01 Jul 2013 19:40

Thank you,

I've found it.

Max

DemetrionQ
Devart Team
Posts: 271
Joined: Wed 23 Jan 2013 11:21

Re: Demo files.

Post by DemetrionQ » Tue 02 Jul 2013 09:33

If any other questions come up, please contact us.

multi
Posts: 4
Joined: Thu 22 Apr 2021 10:13

Re: Demo files.

Post by multi » Thu 22 Apr 2021 10:32

Hi, I installed the SecureBridge trial, and connected succesfully a TScHttpWebRequest thru a simple URL in post mode.

Now I want to send different parameters to my TScHttpWebRequest,
I use Delphi7, Tbytes does not exist there.

How can I send the parameters in Delphi7 ?

As I have no experience, an example would be welcome.

Thanks
Bernard

ViktorV
Devart Team
Posts: 3027
Joined: Wed 30 Jul 2014 07:16

Re: Demo files.

Post by ViktorV » Thu 22 Apr 2021 10:52

To solve the "Undeclared identifier: 'TBytes'" error, please add the ScTypes unit to the USES clause of your unit.

Kind regards,
Viktor

multi
Posts: 4
Joined: Thu 22 Apr 2021 10:13

Re: Demo files.

Post by multi » Thu 22 Apr 2021 11:07

Thanks Viktor for your fast reply, I have declared Buf: TBytes and it is fine now.

next step is to load the 'Buf' with a string, I found a demo like:
Buf := TEncoding.UTF8.GetBytes('This is a test that posts this string to a Web server.');

but I get: Undeclared Identifier: TEncoding

How can I load the buffer in Delphi 7 from a string ?

Thanks
Bernard

multi
Posts: 4
Joined: Thu 22 Apr 2021 10:13

Re: Demo files.

Post by multi » Thu 22 Apr 2021 15:32

I found a way to convert the string to UTF8 Bytes, but still things do not work,
there are 4 parameters and they are not received correctly on the https server.

Can you please provide a full Delphi7 example that sends parameters (more than 1) to an TScHttpWebRequest thru a post request (https url)?

I want to buy the component but I need to make it work.

Thanks
Bernard

ViktorV
Devart Team
Posts: 3027
Joined: Wed 30 Jul 2014 07:16

Re: Demo files.

Post by ViktorV » Fri 23 Apr 2021 10:20

Please note that you can use following code which will work correctly with all IDE versions supported by SecureBridge:

Code: Select all

  Buf := Encoding.UTF8.GetBytes('This is a test that posts this string to a Web server.');   
Also please add the ScCLRClasses unit to the USES clause of your unit.

Kindly note that in order to pass parameters you can specify them in URL itsel. For example:
https://example.com/path/to/page?name=f ... r=purple

Please note that you can also use the TScHttpWebRequest.Headers property. You can use the TScHttpWebRequest.Headers.Add method to set the required values.
For example:

Code: Select all

  ScHttpWebRequest.Headers.Add('ParamName', 'ParamValue'); 
Best regards,
Viktor

multi
Posts: 4
Joined: Thu 22 Apr 2021 10:13

Re: Demo files.

Post by multi » Fri 23 Apr 2021 14:33

Thanks Viktor,
I am now trying to send an XML text to an https url, I cannot make it work yet ...

var
Buf : TBytes;
Request: TScHttpWebRequest;

then I have

URL := 'https://yyyyyyyyyy/oauth';
Request := TScHttpWebRequest.Create(URL);

try
Request.Method := rmPost;
Request.ContentType := 'application/x-www-form-urlencoded'; // (I also tried Request.ContentType := 'application/json';)


postdata := ' { '+
'grant_type: "client_credentials",' +
'scope: "pull-channel",'+
'client_id: "xxxxxxxxxxxx",'+
'client_secret: "yyyyyyyyyyyyyyy"' +
'}';

Buf := Encoding.UTF8.GetBytes(postdata);

Request.ContentLength := Length(Buf);
Request.WriteBuffer(Buf);

Response := Request.GetResponse; --> internal server error

Do you see any error in this code ?

Thanks again for your support and have a great weekend !

Bernard

ViktorV
Devart Team
Posts: 3027
Joined: Wed 30 Jul 2014 07:16

Re: Demo files.

Post by ViktorV » Tue 27 Apr 2021 11:39

Hi Bernard,

This error is not related to SecureBridge but to work of the server instead. In order to resolve it please refer to server specifications to get the correct type of ContentType and format of request it expects.

Best regards,
Viktor

Post Reply