Page 1 of 1

Demo files.

Posted: Thu 27 Jun 2013 23:00
by bme79
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

Re: Demo files.

Posted: Mon 01 Jul 2013 10:26
by DemetrionQ
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).

Re: Demo files.

Posted: Mon 01 Jul 2013 19:40
by bme79
Thank you,

I've found it.

Max

Re: Demo files.

Posted: Mon 01 Jul 2013 19:40
by bme79
Thank you,

I've found it.

Max

Re: Demo files.

Posted: Tue 02 Jul 2013 09:33
by DemetrionQ
If any other questions come up, please contact us.

Re: Demo files.

Posted: Thu 22 Apr 2021 10:32
by multi
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

Re: Demo files.

Posted: Thu 22 Apr 2021 10:52
by ViktorV
To solve the "Undeclared identifier: 'TBytes'" error, please add the ScTypes unit to the USES clause of your unit.

Kind regards,
Viktor

Re: Demo files.

Posted: Thu 22 Apr 2021 11:07
by multi
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

Re: Demo files.

Posted: Thu 22 Apr 2021 15:32
by multi
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

Re: Demo files.

Posted: Fri 23 Apr 2021 10:20
by ViktorV
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

Re: Demo files.

Posted: Fri 23 Apr 2021 14:33
by multi
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

Re: Demo files.

Posted: Tue 27 Apr 2021 11:39
by ViktorV
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