Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
POST Multipart data from InternetExplorer.Application
Message
General information
Forum:
Visual FoxPro
Category:
Internet applications
Title:
POST Multipart data from InternetExplorer.Application
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01132344
Message ID:
01132344
Views:
95
Hi all,

I'm working on a project... Don't WANT to force users to install other party utilities, libraries, etc, so I'm considering just using the Internet Explorer...

I need to push data (actually XML content) up to a website ex: //localhost/mysite/mypage.aspx

I can create the IE object via oIE = createobject("InternetExplorer.Application"), but I'm stuck with the posting of the XML string... for obvious reasons, if I'm uploading a table, or even multiple table schema via XML, that won't work well via the query string. So I went to the direction of "Multipart" form/data. I have the boundary definition, etc.

The headers I have identify the multi-part boundary info


When I try the oIE.Navigate( url, "", "", lcPostData, lcHeaders ), I get to the debugger of the .aspx page, but looking everywhere, I don't see any identifier to the XML. I check the type of request and it shows "GET" instead of "POST".

So, I try adding the header to identify the "Content-Length", and then I get NO response.. IE just hangs until I hit escape...
LOCAL oIE as InternetExplorer.Application
LOCAL loXMLAdapter as XMLAdapter
LOCAL lcXML as String 

SELECT a1.*;
	FROM MyDataDir\MyTable a1;
	INTO CURSOR C_SendToWeb
	
loXMLAdapter	= NEWOBJECT( "XMLAdapter" )
lcXML	= ""
WITH loXMLAdapter
	*/ Add schema per table/cursor
	.AddTableSchema( "C_SendToWeb" )
	.ToXML( "lcXML" )
	.ReleaseXML()
ENDWITH
USE IN SELECT( "C_SendToWeb" )
USE IN SELECT( "MyTable" )


#DEFINE dcCRLF CHR(13)+CHR(10)
#DEFINE MULTIPART_BOUNDARY		"---------------CompleX12345BounDary67890DR"

lcPostData	= "--" + MULTIPART_BOUNDARY + dcCRLF;
			+ [Content-Disposition: form-data; name="]+ [TableXML]+["];
			+ dcCRLF + dcCRLF + lcXML ;
			+ "--" + MULTIPART_BOUNDARY + dcCRLF + dcCRLF
lnPostSize	 = LEN(lcPostData )

lcHeaders	= ""
lcHeaders	= lcHeaders + "Content-Type: multipart/form-data; boundary=" + MULTIPART_BOUNDARY ;
			+ dcCRLF + dcCRLF
lcHeaders	= lcHeaders + "Content-Length: " + ALLTRIM( STR( lnPostSize )) + dcCRLF 

lcMyPage = "http://localhost/MySite/MyPage.aspx"

oIE = CreateObject("InternetExplorer.Application")
oIE.Navigate( lcURL, 0, "", @lcPostData, @lcHeaders )
DO WHILE oIE.ReadyState <> 4
	WAIT WINDOW "test" TIMEOUT 1
ENDDO 
WAIT CLEAR 
Again, if I post WITHOUT using the Content-Length, I get a response... add the content-length it hangs... Any ideas?

Thanks
Next
Reply
Map
View

Click here to load this message in the networking platform