Quantcast
Channel: West Wind Message Board Messages
Viewing all articles
Browse latest Browse all 10393

Trying to send an XML document to state of MD server

$
0
0
Trying to send an XML document to state of MD server
Web Connection
Trying to send an XML document to state of MD server
Jul. 18, 2013
04:38 pm
3U20ZOH7IShow this entire thread in new window
Gratar Image based on email address
From:John Kiernan
To:All
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)
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


Viewing all articles
Browse latest Browse all 10393

Trending Articles