Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
HttpGet() won't follow redirection
Message
 
To
09/05/2018 11:08:20
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
West Wind Web Connection
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2003
Database:
MS SQL Server
Miscellaneous
Thread ID:
01659865
Message ID:
01660008
Views:
63
Hmmm... wwHttp should auto-redirect as long as the redirect is a 301 or 302.

In fact, WinInet requires that you explicitly turn redirect off and that flag exists in wconnect.h (INTERNET_FLAG_NO_AUTO_REDIRECT).

One issue is that a REDIRECT cannot POST. Redirect just re-routes a URL it does not send data so that's probably why the redirect URL fails with a 401 Not Found (invalid endpoint for GET operation).

Since this is an API I think what's supposed to happen is that you turn off Auto redirect, capture the status code, check for 301/302 and then pick up the Location header to figure out the page you need to submit to. Convoluted yes, but I believe required if they are using redirects.

+++ Rick ---

>I was accessing a kind of web service for a number of years. No WSDL or any such, just sending url-encoded xml and getting more xml in return and it worked fine.
>Now it redirects me from www.someserver.com/portal/services to /#/portal?query= and then I'm supposed to add xml={actual xml here} to the url. However, HTTPGet() just returns the redirection but of course can't follow it. Tried to navigate directly to www.someserver.com/#/portal?query= but it seems that some bit gets lost in the process. In the headers returned I get a "1.1 404 not found", and the buffer returned contains some html saying "Cannot POST /".
>
>The service is 99% serving browser clients, i.e. other web apps. I seem to be their only fat client (though opinions may vary, I got only 86kg), going HttpGet() without a browser, so... anyone knows a trick for this?
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform