Anyway...
I did come to figure out what the problem was and you've probably already fixed this in a later version, but it's this way in both virgin copies of wwHTTP.prg for WW468 I have here.
It's in the function "HTTPGetEx". In this section:
*** NOTE: extra dashes required to simulate browser operation!
lcPostBuffer = lcPostBuffer + "--" + MULTIPART_BOUNDARY + CR
As the two dashes AFTER the multi-part boundary denote the ending of a section.
This took a bunch of work on my part (and someone from the state of Maryland IT department), but we found it!
Just thought you should know.
If you're trying to upload a file like an HTML file upload you need do it like this:
loHttp.nHttpPostMode = 2
loHttp.AddPostKey("XmlFile","c:\temp\xmlfile.xml",.T.)
http://west-wind.com/webconnection/docs?page=_0rs0twgr6.htm
If you just need to send the XML as an XML POST buffer (ie. as raw data not like HTML upload) then you can use:
loHttp.nHttpPostMode = 4
loHttp.AddPostKey(lcXmlString)
If you're trying to mimic the HTML you're using in the first example, you'll need to use the code from the first example I posted here.
Oh and PLEASE format the code that you post - that's what the links at the top of the post form are for...
+++ Rick ---
If you need to upload XML
Hey WW folks...
Been using West Wind for years, but this is the first time I've tried to send an XML file (I think).
I have an XML file that passes muster with the state. I can upload it manually with a super small HTML I wrote:
<HTML>
<body>
<form action="https://pcispreprod.dhmh.state.md.us/Pcis2New2a/upload/incident" enctype="multipart/form-data" method="post">
<input type="file" name="upload" >
<input type="submit" value="Submit" >
</form>
</body>
</html>
I get back:
<incidents>
<incident_ir>
<provider_no>C020</provider_no>
<agency_id>97759</agency_id>
<incident_id>2235</incident_id>
<upload_result>Success</upload_result>
</incident_ir>
</incidents>
However...
When I try this:
loHTTP = CREATEOBJECT("wwHTTP")
lcUrl = [https://pcispreprod.dhmh.state.md.us/Pcis2New2a/upload/incident]
loHTTP.cusername = [tester]
loHTTP.cpassword = lcPassword
*** Set mode to multi-part form
loHttp.nHttpPostMode = 4
*** Posting XML
lcXML = FILETOSTR("test3.xml") &&Hard coded for name for testing
loHTTP.AddPostKey() && Clear POST buffer
loHTTP.AddPostKey(lcXML)
*** I've also tried this method below with all PostMode settings too (didn't work)
*loHttp.AddPostKey("File","test3.xml",.T.)
lcString = loHTTP.HttpGet(lcUrl)
What I get back is (I tried all Post Modes out of frustration):
If loHttp.nHttpPostMode = 1:
<incidents>
<upload_result>Fail</upload_result>
<upload_error>4.Unknown error occurred: Expected 'EOF'.</upload_error>
</incidents>
If loHttp.nHttpPostMode = 2:
<incidents>
<upload_result>Fail</upload_result>
<upload_error>3.Unknown error occurred: Stream ended unexpectedly</upload_error>
</incidents>
If loHttp.nHttpPostMode = 4:
<incidents>
<upload_result>Fail</upload_result>
<upload_error>4.Unknown error occurred: Start of root element expected.</upload_error>
</incidents>
Anybody know what I can be doing wrong? Again, this exact XML file uploads fine manually. I even tested the XML file at the W3Schools validator: http://www.w3schools.com/xml/xml_validator.asp and it says "No errors".
Help! Thanks in advance!
-- John Kiernan, VocShop