Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Capturing data on client machine from a ASP page.
Message
General information
Forum:
Visual FoxPro
Category:
Internet applications
Miscellaneous
Thread ID:
00384415
Message ID:
00407106
Views:
81
Glad you found it...

Just FYI, if you're posting XML from client to server you shouldn't send it as urlencoded content, but as XML. The proper content tyep for this is text/xml.

One advantage here is that this is raw content - no encoding occurs on this. If you post application-x-urlencoded the client should expect to decode the using URLdecoding which in the case of XML is very inefficient.

+++ Rick ---



>Rick,
>
>Finally solved the problem. You were right about it being a Header problem. The CGI script apparently was setup to check if the request was coming from a form or not. I was able to fool the server by issueing oXMLHTTP.setRequestHeader("Content-Type", "application/x-www-form-urlencoded") and that did the trick.
>
>Thanks for letting me bounce all of this off of you.
>
>Ed
>
>>Not really sure what the problem is on your end. I have a number of browser based applications that are using XMLHTTP on the client with no problems. Your problem may have something to do with the server side not recognizing what you're sending due to missing headers. IIS is very tolerant - other servers are not.
>>
>>+++ Rick ---
>>
>>
>>>Rick,
>>>
>>>Appreciate the feedback. I've been going over the XML SDK (as much as I can make heads or tails out of it) since I posted this question. I think that my solution might lie in using Execute() with POST instead of Open(). I'm no longer getting any error messages but I'm not getting any Response either. Since this works using a very plain HTML FORM with a POST action I wouldn't think that the CGI script is looking for anything unusual. I think that at this point I just need to figure out what an HTML FORM sends. There is the ACTION= and the various INPUTs name=value pairs. I know about the URL encoding at least about turning the spaces into + and about the & separating the name=value pairs. I've seen various examples that have framming the POSTed data and I've seen the use of ? at the beginning of the data string. I've tried every possible combination that I can think of and either get errors or nothing. Is there any way to trap what an HTML FORM sends out
>>so
>>>that I can try and duplicate that?
>>>
>>>Any guidence would be appreciated.
>>>
>>>Ed
>>>
>>>>If you use POST with XMLHTTP you have actually have to post something or the call will fail. I had this problem in my XML Chat - it would inconsistently fail when you post iwth no data. Using GET was caching so a POST fixed that problem, but I had to send a few bytes just in case.
>>>>
>>>>You may also have to add the appropriate content type header to the request especially if you're posting to a non-IIS server or some backend software that checks for specific content types.
>>>>
>>>>+++ Rick ---
>>>>
>>>>
>>>>
>>>>>Mike,
>>>>>
>>>>>Using XMLHTTP Control to duplicate an HTML Form Submit.
>>>>>
>>>>>I created an HTML page with this form:
>>>>>
>>>>> FORM ACTION="http://www.usps.gov/cgi-bin/zip4/zip4inq" METHOD=POST
>>>>> INPUT TYPE=hidden NAME=street VALUE="1030 Honey Hill Dr."
>>>>> INPUT TYPE=hidden NAME=zip VALUE="77077"
>>>>> INPUT TYPE=submit VALUE="Standardized US Address"
>>>>> /FORM
>>>>>
>>>>>The Form sends this address to the Post Office and the Post Office server will send back the corrected address (if there are errors) plus Zip+4, Carrier Route, Delivery Point Number, etc.
>>>>>
>>>>>I want to duplicate this Form using the XMLHTTP Control but I'm not sure how to duplicate what the HTML Form is actually sending to the Postal Server. What I have so far using your previous example as a template is:
>>>>>
>>>>>oX=CreateObject('microsoft.xmlhttp')
>>>>>oX.Open("GET", "http://www.usps.gov/cgi-bin/zip4/zip4inq?Submit=Standardized+US+Address&street=1030+Honey+Hill&zip=77077", .f.)
>>>>>oX.Send()
>>>>>? oX.ResponseText
>>>>>
>>>>>What happens is that I get a message back from the Postal Server that says "This Script should be referenced with a METHOD of POST."
>>>>>
>>>>>Figuring that the OPEN("GET"…. might have been a METHOD=GET, I changed this line to OPEN("POST",…. but got the same results.
>>>>>
>>>>>Any idea of what I should be sending as my oX.OPEN()?
>>>>>
>>>>>Any Help would be appreciated.
>>>>>
>>>>>Ed
>>>>>
>>>>>
>>>>>>Microsoft's XMLHTTP control (contained in their xml parser in msxml.dll)
>>>>>>
>>>>>>Try this in the vfp command window:
>>>>>>oX=CreateObject('microsoft.xmlhttp')
>>>>>>oX.Open("GET", "http://www.microsoft.com", .f.)
>>>>>>oX.Send()
>>>>>>?oX.ResponseText
>>>>>>?oX.GetAllResponseHeaders()
+++ 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
Reply
Map
View

Click here to load this message in the networking platform