I am using the following test code to get some value from my local web server script to VFP client.
===============
Client Side code is
===============
LOCAL lcCodelcCode = "ABCD"
loHTTP = CREATEOBJECT("wwHTTP")
*** Posting Form Variables
loHTTP.nHttpPostMode = 1loHTTP.cHttpVerb = "GET" && Also tried it with POST.
loHTTP.AddPostKey()loHTTP.AddPostKey("code",lcCode)
IF loHTTP.nError <> 0
? loHTTP.nError
set step on
ENDIF? lcStr
RETURN
This code return no error but complete web page is not returned. I only get this
<Html>
<body>
</body>
</Html>
if I run the above code without Addpostkey() as
lcStr = loHTTP.HttpGet("server-ip/script.wws?lcCode=ABCD")
I get the complete result from my web server.
What am I doing wrong with AddPostKey() version ?
The server code "script.wws" is
=============================
<Html>
<body>
<%
local lcCode
lcCode = ''lcCode=IIF(ISNULL(Request.Querystring("code")),'',Request.Querystring("code"))
if type('lcCode') <> 'C'
lcCode = ''
endiflcCode = allt(lcCode)
lcRetStr = ""
if !empty(lcCode)
SELECT * ;
FROM table1 ;
where alltrim(code) == lcCode ;
INTO CURSOR tCursorselect tCursor
=CURSORTOXML(0,'lcRetStr',1,1+2,0,'1')use in sele('tCursor')
use in sele('table1')
endif
%>
<%=lcRetStr%></body>
</Html>
o = newobject('wwHTTP', 'wwHTTP.prg')
o.addPostKey('key', transform(value))
result = o.HTTPget(URL)
server
value = cast(evl(m.request.form('key'), m.request.queryString('key')) as ...)select ... where key = m.value
etc.
Hi,
I am using the following test code to get some value from my local web server script to VFP client.
===============
Client Side code is
===============
LOCAL lcCodelcCode = "ABCD"
loHTTP = CREATEOBJECT("wwHTTP")
*** Posting Form Variables
loHTTP.nHttpPostMode = 1loHTTP.cHttpVerb = "GET" && Also tried it with POST.
loHTTP.AddPostKey()loHTTP.AddPostKey("code",lcCode)
IF loHTTP.nError <> 0
? loHTTP.nError
set step on
ENDIF? lcStr
RETURN
This code return no error but complete web page is not returned. I only get this
<Html>
<body>
</body>
</Html>
if I run the above code without Addpostkey() as
lcStr = loHTTP.HttpGet("server-ip/script.wws?lcCode=ABCD")
I get the complete result from my web server.
What am I doing wrong with AddPostKey() version ?
The server code "script.wws" is
=============================
<Html>
<body>
<%
local lcCode
lcCode = ''lcCode=IIF(ISNULL(Request.Querystring("code")),'',Request.Querystring("code"))
if type('lcCode') <> 'C'
lcCode = ''
endiflcCode = allt(lcCode)
lcRetStr = ""
if !empty(lcCode)
SELECT * ;
FROM table1 ;
where alltrim(code) == lcCode ;
INTO CURSOR tCursorselect tCursor
=CURSORTOXML(0,'lcRetStr',1,1+2,0,'1')use in sele('tCursor')
use in sele('table1')
endif
%>
<%=lcRetStr%></body>
</Html>
If you are planning to return XML using a template is not a good way to do it unless there's only code in the template. Even if your code was working you'd get HTML wrapped inside of an HTML header which would be invalid XML.
Using a process method is better for this sort of thing. If you're displaying the initial data call Response.ExpandScript() to display the HTML. When you're posting the data back render the XML then return the raw XML response:
Response.ContentType = "text/xml"
Response.Write(lcXml)
+++ Rick ---
Hi,
I am using the following test code to get some value from my local web server script to VFP client.
===============
Client Side code is
===============
LOCAL lcCodelcCode = "ABCD"
loHTTP = CREATEOBJECT("wwHTTP")
*** Posting Form Variables
loHTTP.nHttpPostMode = 1loHTTP.cHttpVerb = "GET" && Also tried it with POST.
loHTTP.AddPostKey()loHTTP.AddPostKey("code",lcCode)
IF loHTTP.nError <> 0
? loHTTP.nError
set step on
ENDIF? lcStr
RETURN
This code return no error but complete web page is not returned. I only get this
<Html>
<body>
</body>
</Html>
if I run the above code without Addpostkey() as
lcStr = loHTTP.HttpGet("server-ip/script.wws?lcCode=ABCD")
I get the complete result from my web server.
What am I doing wrong with AddPostKey() version ?
The server code "script.wws" is
=============================
<Html>
<body>
<%
local lcCode
lcCode = ''lcCode=IIF(ISNULL(Request.Querystring("code")),'',Request.Querystring("code"))
if type('lcCode') <> 'C'
lcCode = ''
endiflcCode = allt(lcCode)
lcRetStr = ""
if !empty(lcCode)
SELECT * ;
FROM table1 ;
where alltrim(code) == lcCode ;
INTO CURSOR tCursorselect tCursor
=CURSORTOXML(0,'lcRetStr',1,1+2,0,'1')use in sele('tCursor')
use in sele('table1')
endif
%>
<%=lcRetStr%></body>
</Html>
West Wind Technologies
Making waves on the Web
from Hood River