PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → HTTPRequest struggling to get working
HTTPRequest struggling to get working
Iniciado por guest, 03,feb. 2018 12:08 - 8 respuestas
Publicado el 03,febrero 2018 - 12:08
I have a server with IP address 213.39.109.140 and have placed a test zip file in the location shown. I am obviously not understanding this but why does this not work? Both commands return Error Code 0

EM_AndTablet is the data folder of the User. It's actual path on the server is C:\AmbritDatabases\EM_AndTablet

I have made sure the path is correct and that capitalization is accurate. I have tried full path, offset etc.

HTTPDestination("C:\Ambrit\Development\Equine Manager\Mobile\Android\Equine Manager Android Tablet\Exe\AmbritFTPFiles\Files.zip")
Error(ErrorInfo(errFullDetails))
HTTPRequest("213.39.109.140/EM_AndTablet/Sync/Subscriber/AndroidTabletd20180202t09483735/Data/Files.zip")
Error(ErrorInfo(errFullDetails))

Any suggestions much appreciated. Thx.
Publicado el 03,febrero 2018 - 12:38
Hi John

what does "does not work" means?
why are you not testing the return value from httrequest?
why does your uRL not contain "http://' at the beginning?
What is the error message?

basically, we don't have enough information to figure out what's going on...

So, this is what I would do:
- remove the httpdestination and test the return value of the httprequest..
- if the httprequest is in error, post the error message here
- if it's not, then you know that the problem is not in the request, but in the saving, and we can try things...

Best regards
Publicado el 03,febrero 2018 - 12:48
Thank you for your quick response.

I thought I had tested the response from both commands by checking the errorcode() which is 0 in both cases.

What happens is that a file is created on the local device (2kb ) which is clearly not right and not a valid Zip file.

I am not sure what folder I need to use to access the actual file itself, if it is a full path or relative path.

Also I am not using http:// as I thought that was only for a URL which I don't have, only the IP address.

Thx
Publicado el 03,febrero 2018 - 15:14
I don't understand what I have to do now. Sorry.

I have now added http://213.39.109.140 and even added the Port. I have tried everything and just getting nowhere I'm afraid.

When I debug the HttpRequest it returns errorcode 0 and the debugger returns a value of True.

I am told I can try it manually via a browser but what do I type in? Again everything I try does not work. The extension .zip is defined as a Mime type on the server. It has to be something obvious but darned if I can see what I am doing wrong.

I am not sure how I am allowed access to the server anyway as there is no username or pwd but none of the examples show that being used.

So given the IP address is 213.39.109.150, the file exists in the folder structure and the port is 90 - what do I type in to the browser please to test?

Thx so much if anyone can help.
Publicado el 03,febrero 2018 - 15:33
Hi

what you type in the browser is exactly what you have in your httprequest string...

If it dosn't work in the browser, it means that the problem is either that your url is incorrect, or that your server is not setup correctly for what you are trying to do...

Now, I just tested your URL in my browser and got a 404 error page (which is probably the content of your 2KB file)...

that means that your URL and server are not in sync...

I'm GUESSING that the problem is that statement "...EM_AndTablet is the data folder of the User.."

When you are using a URL to access directly a file, this file is supposed to be in a SUBdirectory of the root directory of the web site corresponding to your domain part in the URL (in this case, your IP address)

Your web server has been configured to MATCH this domain name with a directory, and for security reason, that directory is NEVER C:\

So you probably need to work on your server configuration here, because files are not where they are supposed to be for this to work properly

Best regards
Publicado el 03,febrero 2018 - 15:39
Thanks Fabrice. I suspected something server side was the issue.

This means that to copy Data files from a Users folder on the server is going to be a bit messy.

I am just trying to get rid of FTP but not quite sure if this really is the way forward.

Anyway will try what you suggest and see what happens.

Thx again

John
Publicado el 03,febrero 2018 - 16:04
THANK YOU so much Fabrice. I now have it working.

So now to see if it is faster to zip the files, copy then into the required folder and use HTPRequest or continue using FTP.

It's just that FTP does not seem 100% reliable but not sure if this is worth the effort
Publicado el 03,febrero 2018 - 16:10
Hi John

>It's just that FTP does not seem 100% reliable but not sure if this is worth the effort

It is only "reliable" if a human being initiates it and monitors. Not matter the language being used it is often not reliable when left unattended. So best to try something else.

André
Publicado el 03,febrero 2018 - 16:59
So now I have data coming down FROM the server, how do I push it up? I cannot find HTTPPost or similar.

If HTTPRequest has then got to be performed server side, how do you tell it the location of the local data as that could be anywhere on any device.

Thx