473,395 Members | 1,977 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Use DIME/attatchment to download an application

Hi
I have no problem downloading an image with Web Services Enhancements and
the DIME specification, but how do I dowwnload an application?
Regards
/Niklas

Web service:

<WebMethod()> _
Public Sub CreateDimedApplication(ByVal FileName As String)
Dim sendFile As System.IO.FileStream
sendFile = System.IO.File.OpenRead(FileName)
Dim att As New DimeAttachment("application/dime", TypeFormat.Unknown,
sendFile)
ResponseSoapContext.Current.Attachments.Add(att)
End Sub

Client:

Private Sub SaveFile(ByVal att As System.IO.Stream)
Dim data() As Byte = ConvertStreamToByteBuffer(att)
If (System.IO.File.Exists(m_localFile)) Then
System.IO.File.Delete(m_localFile)
End If
Dim outFile As System.IO.FileStream
outFile = System.IO.File.OpenWrite(m_localFile)
outFile.Write(data, 0, data.Length)
outFile.Close()
End Sub

Private Function ConvertStreamToByteBuffer(ByVal theStream As
System.IO.Stream) As Byte()
If (theStream.Position > 0 And theStream.CanSeek) Then
theStream.Position = 0
End If
Dim oneByte As Integer
Dim tempStream As New System.IO.MemoryStream
While (oneByte = theStream.ReadByte() <> -1)
tempStream.WriteByte(CByte(oneByte))
End While

Return tempStream.ToArray()
End Function

Private Sub cmdCopyFile_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdCopyFile.Click
Dim svc As MyDimeServiceWse = New MyDimeServiceWse
svc.CreateDimedApplication(m_serverFile)
If svc.ResponseSoapContext.Attachments.Count = 1 Then
SaveFile(svc.ResponseSoapContext.Attachments(0).St ream)
End If
End Sub
Nov 21 '05 #1
0 976

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Levi Wilson | last post by:
I have a web service that adds a DIME attachment: public void GetFile(string filename) { SoapContext sc = HttpSoapContext.ResponseContext; DimeAttachment dimeFile = new...
1
by: Drew | last post by:
I am having trouble with receiving an attachment via WSDL/Dime. I have a service that I am connected to on a Single Board Computer running linux. The Single Board contains a text file that is...
3
by: Vai2000 | last post by:
Thanks for all responses Please advice! Hi All, Clients are uploading large files to my Web Portal. I need to validate these files using a WS. Problem is file sizes are in the range of...
2
by: Champika Nirosh | last post by:
Hi All, I posted this at "webserviceehnancement" but no reply please see I installed WSE 2.0 and then started to write a web service that use DIME. I fallowed...
0
by: Niklas | last post by:
Hi I have no problem downloading an image with Web Services Enhancements and the DIME specification, but how do I dowwnload an application? Regards /Niklas Web service: <WebMethod()> _...
4
by: Sean Feldman | last post by:
Hello, I've installed WSE2 and succedded to download from WebService DataTable object, but can't do the oposite. Anyone can help please? Thanks a lot!
1
by: Modica82 | last post by:
Hi all, I have been trying to find a way to send a PDF from my web service. I have had the idea of sending back a byte array, but to be honest the efficiency issue is there and i would like to...
0
by: Tom_B | last post by:
Trying to download a .wav file from a Java Axis web service that is using DIME. Unfortunately, the returned data is not properly formed so cannot use WSE with Dime handling to read the data. ...
0
by: daryl | last post by:
I have a situation where a webservice has worked fine in a development environment, but when placed into production has stopped working (although at one time it was). Using WSE 2.0/DIME, we...
6
by: Martin | last post by:
I have a link in a page that allows the user to download a dynamically created XLS file. I add these headers and everything works correctly - as long as the .xls file is in the "home" folder....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.