title: Send/POST xml file using VB
body: <p>I am trying to post a well-formed cxml file to a remote server url.  My code makes the connection but fails on the actual SEND command.  I am not necessarily a newbie to VBA but I am a newbie to POSTING xml and posting help request to this forum.  Hope I did it right.</p>
  
  <p>I get status = 200 and a response of "Missing XML" when I post.  It appears that the XML data is not actually getting uploaded to remote server</p>
  
  <pre><code>remoteurl = "http://myremoteurl.com/incoming"
  FileNameXML = XML file read into a string variable
  FileNameSource = fullpath &amp; filename of XML file="C:\xmls\test00001.xml"
  
  ' I am calling the following function &amp; storing response
  xmlresp = HTTPPostTXT(remoteurl, FileNameXML, FileNameSource)
  
  Function HTTPostTxt(ByVal sUrl As String, xmlText As String, ByVal xmlname As String)
    Set XMLHTTP = CreateObject("Microsoft.XMLHTTP")
    XMLHTTP.Open "POST", sUrl, False
    Set xmldom = CreateObject("Microsoft.XMLDOM")
    xmldom.LoadXML xmlText
    xmldom.Validate
    ' xmldom.xml does not error out but XML file does not get sent/uploaded 
    XMLHTTP.send xmldom.xml
    MsgBox XMLHTTP.Status &amp; " " &amp; XMLHTTP.responseText   ' Return Status # &amp; reponseText
  
    ' I am storing response and status for troubleshooting
    If XMLHTTP.Status &lt;&gt; 200 Then
      Sheets(Shtname).Cells(iRow, 6).Value = XMLHTTP.responseText
      HTTPPostTxt = "Failure"
    Else
      Sheets(Shtname).Cells(iRow, 6).Value = XMLHTTP.responseText
      HTTPPostTxt = "Accepted"
    End If
  End Function
  </code></pre>
  
  <p>(1) I am looking for help on what I am doing wrong with sending the XML string data.  This is assuming that this is why I can't SEND data.  Here is how I read the XML file into String variable</p>
  
  <pre><code>Function XMLFileString(ByVal XMLFileName As String) As String
    Dim text, textline As String
    Open XMLFileName For Input As #1
    Do Until EOF(1)
      Line Input #1, textline
      text = text &amp; textline
    Loop
    Close #1
    XMLFileString = text
    End Function
  </code></pre>
  
  <p>(2) Changing the SEND command to send the actual file (using fullpath &amp; filename) is an option.  Not sure what to change.  I think I need to change the LOADXML command to a LOAD and use the filename.</p>