Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
HttpGet() won't follow redirection
Message
From
10/05/2018 10:58:00
 
 
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:
01659902
Views:
53
>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?

Dragan,

This will not solve your issue, but may be give something more for you to work (if you didn't check it already).
LOCAL HTTP AS WinHttp.WinHttpRequest
LOCAL URL AS String
LOCAL Redirected AS String

m.URL = "http://www.someserver.com/#/portal?query=somedata"

m.HTTP = CREATEOBJECT("WinHttp.WinHttpRequest.5.1")	

m.HTTP.Open("Get", GETWORDNUM(m.URL, "#", 1), .f.)	&& I don't think browsers send anything past the fragment symbol
m.HTTP.Send()

IF m.HTTP.Status = 302		&& other codes may have to be considered
	m.Redirected = m.HTTP.Getresponseheader("Location")
	MESSAGEBOX(TEXTMERGE("Redirected to <<m.Redirected>>"))
	m.HTTP.Open("Get", m.Redirected, .F.)
	m.HTTP.Send()
ENDIF

? "" + m.HTTP.Responsebody
At least you'll know to where you're being redirected. Then you'll have to figure out some way to pass your arguments to the Web Service (without actually trying it is difficult for me to give more "ideas" beside this one...).
----------------------------------
António Tavares Lopes
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform