Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread TServerRequest URL that is going to be executed
Tue, Jul 4 2017 11:24 AMPermanent Link

Big Al

I am working on my first TServerRequest for a php webservice that I'm building.

I have the request executing but I'm getting a Not Found error so I am trying to understand what I'm doing wrong.

I am not use internal web server. I am using XAMPP and running the ewb app from XAMPP which works.

I thought I would try to see if I could get phpinfo to work so I created a phpinfo.php file and put in the root of the application.

I then did the following:

MyRequest.TServerRequest.Create(nil);

MyRequest.URL:='/phpinfo.php';
MyRequest.OnComplete:=RequestComplete;
MyRequest.Execute;

in my RequestCompletd procedure I have:

if (Request.StatusCode=HTTP_OK) then
  ShowMessage(Request.ResponseContent.Text)
else
  ShowMessage('Response Error: ' + Request.StatusText);


Is there a way to display the URL that's going to be executed before it's executed so I can see what url it should be running?

I am getting closer but not quite there yet. Thanks everyone for not beating me up while I'm learning.

Big Al
Tue, Jul 4 2017 11:42 AMPermanent Link

Big Al

>Big Al wrote:

>MyRequest.URL:='/phpinfo.php';


An example I was using from an earlier post here had the leaving slash on the URL name.
I took that off and at least I'm getting some data back.

Going to see if it works now with my webservice.

Big Al
Tue, Jul 4 2017 11:43 AMPermanent Link

Big Al

>Big Al wrote:


>Going to see if it works now with my webservice.


That worked, so I have a working TServerRequest.. Nice...

Big Al
Tue, Jul 4 2017 12:11 PMPermanent Link

Matthew Jones

Big Al wrote:

> Is there a way to display the URL that's going to be executed before it's executed

No, but the real answer is to use Chrome as the browser, and hit F12. Other browsers have such systems, but generally not as good as Chrome for this sort of stuff.

You can see all of the requests you make, and the headers and responses. Very handy for debugging this sort of stuff. For more complex queries, I sometimes grab a copy of the response, and then paste it in as a string into my code, so I can get the data reader or whatever working with a fixed and easy "data set" in a simple button onClick handler. When I have it working, I can remove that, and go with live data again.

--

Matthew Jones
Wed, Jul 5 2017 3:04 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

<< Is there a way to display the URL that's going to be executed before it's executed so I can see what url it should be running? >>

2.06 B3 has an TServerRequest.OnStart event along with a RequestURL property that provides the functionality that you're looking for.  It should be out by this evening.

Tim Young
Elevate Software
www.elevatesoft.com
Wed, Jul 5 2017 4:03 PMPermanent Link

Big Al

>Tim Young [Elevate Software] wrote:

<< Is there a way to display the URL that's going to be executed before it's executed so I can see what url it should be running? >>

>>2.06 B3 has an TServerRequest.OnStart event along with a RequestURL property that provides the functionality >>that you're looking for.  It should be out by this evening.

>>Tim Young

Thanks

Big Al
Image