?
Solved

Embed a file for download in SOAP response

Posted on 2003-03-07
6
Medium Priority
?
388 Views
Last Modified: 2007-12-19
Is there a way to embed a file in an XML documet in Binary or otherwise so that the resonse from a Soap request includes the file?

Is this question vague enough?

Just curious...no rush.

Thanks for responses,

Ben
0
Comment
Question by:bnye
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 

Author Comment

by:bnye
ID: 8091796
This link talks about using a DIME service, however it seems that if I could encode the file in base64 I could stick it in the XML file in BIN.BASE64 tags. If anyone has any tips on how to do that from ASP please let me know I would be happy to cut my dev time down.

Thanks,

Ben
0
 

Author Comment

by:bnye
ID: 8091798
I apologize, here is the link:

http://msdn.microsoft.com/msdnmag/issues/02/12/DIME/default.aspx

Thanks,

Ben
0
 

Author Comment

by:bnye
ID: 8091871
I apologize, here is the link:

http://msdn.microsoft.com/msdnmag/issues/02/12/DIME/default.aspx

Thanks,

Ben
0
AWS Certified Solutions Architect - Associate

This course has been developed to provide you with the requisite knowledge to not only pass the AWS CSA certification exam but also gain the hands-on experience required to become a qualified AWS Solutions architect working in a real-world environment.

 
LVL 28

Accepted Solution

by:
sybe earned 200 total points
ID: 8092886
(sometimes the link does not work, i'll just post the code there:)

Function BinaryToXML(ByVal strFileName As String) As String
Dim xmlDoc As New MSXML.DOMDocument
Dim xmlNode As MSXML.IXMLDOMNode
Dim xmlElement As MSXML.IXMLDOMElement
Dim st As ADODB.Stream
Set st = New ADODB.Stream
st.Type = adTypeBinary
st.Open
st.LoadFromFile strFileName
Set xmlElement = xmlDoc.createElement("binary")
Set xmlDoc.documentElement = xmlElement
Set xmlNode = xmlDoc.createElement("filename")
xmlElement.appendChild xmlNode
xmlNode.Text = Dir(txtFileName.Text)
Set xmlNode = xmlDoc.createElement("blob")
xmlElement.appendChild xmlNode
xmlNode.dataType = "bin.base64"
xmlNode.nodeTypedValue = st.Read
BinaryToXML = xmlDoc.xml
Set xmlDoc = Nothing
Set xmlNode = Nothing
Set xmlElement = Nothing
Set st = Nothing
End Function

Sub XMLToBinary(ByVal strXML As String)
Dim xmlDoc As New MSXML.DOMDocument
Dim xmlNode As MSXML.IXMLDOMNode
Dim st As ADODB.Stream
Dim arrBuffer() As Byte
If xmlDoc.loadXML(strXML) Then
Set xmlNode = xmlDoc.selectSingleNode("//binary")
arrBuffer = xmlNode.selectSingleNode("blob").nodeTypedValue
Set st = New ADODB.Stream
st.Type = adTypeBinary
st.Open
st.Write arrBuffer
st.SaveToFile xmlNode.selectSingleNode("filename").Text, adSaveCreateOverWrite
Set xmlNode = Nothing
Set st = Nothing
End If
Set xmlDoc = Nothing
End If
End Sub



0
 

Author Comment

by:bnye
ID: 8098835
Sybe -

This a great example. This seems to be the most clear example I have seen on the subject. However I did find the following examples as well in case other readers decide to look into this.


http://support.microsoft.com/default.aspx?scid=KB;en-us;q254388

http://www.topxml.com/xml/articles/binary/XML%20and%20Binary%20Data2.asp

http://www.15seconds.com/issue/010522.htm

Thanks again,

Ben
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question