XMLHTTP from Microsoft Word to Classic ASP...XML document looses white space

How do I correct my code so that when I send an xml in string over a post that it does not loose the white space in between the attributes

Abbreviated code is as follows
Piece 1:  Word VBA Macro
                       ...
                        strBudgetRows = strBudgetRows & "<Detail BT20OBJ=""BT20.GLKKeyMaster"" Prop=""TitleDl""/>"
                        strBudgetRows = strBudgetRows & "<Detail BT20OBJ=""BT20.GLOObjMaster"" Prop=""ObjDl""/>"
                    strBudgetRows = strBudgetRows & "</ReportFormat>"
                strBudgetRows = strBudgetRows & "</ReportFetch>"
            strBudgetRows = strBudgetRows & "</Request>"
        strBudgetRows = strBudgetRows & "</NetSightMessage>"
    strBudgetRows = strBudgetRows & "</sbixml>"



    Set curlss = CreateObject("Microsoft.XMLHTTP")
    curlss.Open "POST", "https://", False
    curlss.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    curlss.send ("str=" & strBudgetRows)
   
    'curlss.responseText comes back with no spaces between attributes
    ActiveDocument.Tables(3).Cell(1, 1).Range.Text = curlss.responseText
   


Piece 2: Classic asp code
      dim strBudgetRows
      strBudgetRows = request("str")

      set xmlBudgetRows = Server.CreateObject("Microsoft.XMLDOM") : xmlBudgetRows.async = false : xmlBudgetRows.loadXml strBudgetRows
        response.write strBudgetRows
       
Piece 3:  XML is consumed in Piece 2 but the white space is gone, thus the .loadxml fails
<sbixml><NetSightMessage><Header><Connection>bplus</Connection><UserID>BSI</UserID><CurrentLedgersGL="GL"JL="JL"/><Mask>POUPPR</Mask><SubSystem>Purchasing</SubSystem><TraceEna
maxdbaseAsked:
Who is Participating?
 
zc2Commented:
Why are you sending the XML as a parameter of  "application/x-www-form-urlencoded" format, not as "text/xml" ?
strBudgetRows = strBudgetRows & "<Detail BT20OBJ='BT20.GLKKeyMaster' Prop='TitleDl'/>"
                        strBudgetRows = strBudgetRows & "<Detail BT20OBJ='BT20.GLOObjMaster' Prop='ObjDl'/>"
                    strBudgetRows = strBudgetRows & "</ReportFormat>"
                strBudgetRows = strBudgetRows & "</ReportFetch>"
            strBudgetRows = strBudgetRows & "</Request>"
        strBudgetRows = strBudgetRows & "</NetSightMessage>"
    strBudgetRows = strBudgetRows & "</sbixml>"

    Set curlss = CreateObject("Microsoft.XMLHTTP")
    curlss.Open "POST", "https://", False
    curlss.setRequestHeader "Content-Type", "text/xml"
    curlss.send (strBudgetRows)
   

Open in new window


on the server side:
      set xmlBudgetRows = Server.CreateObject("Microsoft.XMLDOM") : xmlBudgetRows.async = false
      if xmlBudgetRows.load( request ) then
        response.write strBudgetRows
      else
         response.write "Failed to parse the XML " & xmlBudgetRows.parseError.reason
      end if

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.