A fellow emailed me wanting to get a PDF file out of a SOAP Envelope and write
it directly out to the browser using Classic ASP. Here's the code I used:
<%
Set m_Doc = Server.CreateObject("MSXML2.DOMDocument")
m_Doc.async = false
m_Doc.ValidateOnParse = false
'This could come from whereever, ADO, a file, another Web Service.
m_Doc.Load Server.MapPath(".") + "\\soapresponse.txt"
'Yes, it's a // XPath, but that's the LEAST of our problems before we get into microperf
Set oNode = m_Doc.selectSingleNode("//GetImageAsBase64Result")
'This is the Magic that makes it possible. Otherwise you'll get a string.
oNode.dataType = "bin.base64"
Response.ContentType="application/pdf"
Response.AddHeader "Content-Disposition", "filename=whatever.pdf"
Response.BinaryWrite oNode.nodeTypedValue
%>