Problem posting XML file to server
I successfully posted an xml file to a server in order to achieve 2 files (one for the poster and the second for the receiver of the xml file. My problem lies in how to process the posted xml file inside the receiver file? Any help would be greatly appreciated.
Re: Problem posting XML file to server
If you want to create the XML while making the HTTP POST request, use the OpenWrite method of WebClient and then create an XmlTextWriter on the stream and write the XML as needed. You can try using a debugging tool like Fiddler if you are facing any problem.
Re: Problem posting XML file to server
With XMLHTTPRequest, you can post a generic HTTP request to a Web server and use XML to send and receive data. Two useful properties of XMLHTTPRequestare are the status and responseText. The status property returns the HTTP status from the page to which you send the XML Document Object Model (XMLDOM), and the responseText property gives you a textual representation of the response from the page.
Re: Problem posting XML file to server
Here is a simple example for your request:
Code:
Set x = CreateObject("MSXML2.DOMDocument")
Set y = CreateObject("MSXML2.DOMDocument")
Set z = CreateObject("MSXML2.DOMDocument")
x.Load (App.Path & "\Request.xml")
Set h = CreateObject("MSXML2.ServerXMLHTTP")
While (Val(DateDiff("s", GetTimeBeforePost, Now)) <= moFinalResponseTime) And h.readyState <> 4
moErrorLogger.LogInformation "Posting the Soap HTTP request...."
'TCS Changes to catch the exception when the web server is down
On Error Resume Next
GetTimeBeforePostNew = Now
h.Open "POST", sURL, True
h.send x
h.waitForResponse (moResponseTime)
If h.readyState <> 4 Then
'Waits for 10 min
While Val(DateDiff("s", GetTimeBeforePostNew, Now)) <= moResponseTime
Wend
h.abort
End If
Wend