473,657 Members | 2,430 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Upload / Download via WebService

Hi

My application consists of a database, WebService and web application. The
web application reads and writes data to the database via the WebService. I
also want to be able to upload/download files via the WebService because my
WebService handles security.

My question is - how can this best be done? After some googleing a solution
I found was to stream bytes in a method like this:

<WebMethod()> _
Public Function UploadFile(ByVa l docbinaryarray As Byte(), ByVal docname
As String) As Boolean
Dim strdocPath As String
strdocPath = "C:\Inetpub\www root\FileUpload DownloadSvc\tem p\" +
docname
Dim objfilestream = New System.IO.FileS tream(strdocPat h,
System.IO.FileM ode.Create, System.IO.FileA ccess.ReadWrite )
objfilestream.W rite(docbinarya rray, 0, docbinaryarray. Length)
objfilestream.C lose()
Return True
End Function
Will this handle large files? Is this the best way to do it or is there
another better solution?

Many thanks!

Julia Beresford
Nov 30 '05 #1
1 2605
Julia

There are a number of options you can use for transmitting large
amounts of binary data. The solution you've listed (known as
base-64-encoding) is an okay solution. Your data will be transmitted
properly and it will be contained within your SOAP envelope (meaning
that you can use things like WS-Security) if you want. It is a highly
interoperable and composable solution. The downside is that it isn't a
very efficient solution. Base 64 encoding of your binary data results
in it bloating up anywhere from 33-100% during the transmission. If you
are planning on transmitting large amounts of data quickly, then you
might potentially run into some performance and latency issues.

There are some other options out there such as DIME and SOAP with
Attachments (SwA). But both of these have issues of their own. The
solution I currently recommend people looking closely at is using
Message Transmission Optimization Mechanism (MTOM). MTOM comes with the
Web Services Enhancements 3.0 from Microsoft. It's a really easy to use
technology that avoids a lot of the pitfalls of the other options.

I've written a brief overview of the different solutions and
specifically MTOM. You can check it out at
http://peterkelcey.com/pk_blog/index.php?m=20051119

I'd also suggest checking out the following article on MSDN
http://msdn.microsoft.com/library/de...opaquedata.asp

Hope that helps

Peter Kelcey

Nov 30 '05 #2

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

Similar topics

10
827
by: Alphonse Giambrone | last post by:
I am trying to develop a web service to accept a file uploaded via http post from a vba (Access) application. Thanks to helpful links in a vb newsgroup and my previous work with WinInet api I was able to write the code to do the upload. I know this works because I tested by posting to an asp page that saves the file. Now I need to create a .NET web service to accept and save the file. Of all the web service samples I found, the only ones...
6
4000
by: Pat Carden | last post by:
Hi, We need to allow webusers to upload a file on our website (on Server3, all servers run Server 2003, remotely hosted) and eventually save it on our SBS Server (Server2) which is not exposed through our firewall. We have another server (Server1) within the SBS domain that is exposed through port 80 of the firewall on which we host some web services and images. What is the best architecture for getting the file from the remotely...
18
4335
by: Jen | last post by:
I'm using Microsoft's own VB.NET FTP Example: http://support.microsoft.com/default.aspx?scid=kb;en-us;832679 I can get the program to create directories, change directories, etc., but I can't get it to upload a file to the FTP server. I just get a "Cannot connect to remote server" error after this TRY: s = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
3
3554
by: Demetri | last post by:
Hello, I'm involved in developing an application which has the need to transfer files automtically once a laptop is connected back to the network. The application i'm developing will automatically realize the network is available and thus pass a file to a web service that will know what to do with the file. My question is what is the best way to transfer a file via a web service that my application will consume to invoke transfer's...
4
6202
by: jf li | last post by:
I have a Asp.net web application and a Asp.net Web service application. The Web application is using HtmlInputFile to get a 50M size of file selected by end user, read the data of this file and pass the data to the web service. I already modified both web.config files and changed maxRequestLength to 60000(kb). When I debug the upload process, it seems the Web application can get the 50M file and read the data without problem, but when the...
0
1576
by: Roland Riess | last post by:
Hi, as an absolute web and configuration beginner I am stuck with a problem and so I finally seek your help again: Development tools: ASP.NET 1.1, C#, VS 2003, Windows 2000 SP4, IIS 5.0 I developped a web service that writes data from a text file uploaded from a Pocket PC to a database, and then prepares another text file with updated master data for download by the Pocket PC.
0
9795
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted by the software in your host machine. Stack Trace at System.Net.Sockets.NetworkStream.Write(Byte buffer, Int32 offset, Int32
7
3728
by: dragiton | last post by:
SA Upload SQL Database variable types (image upload and storage) I am having trouble with the SA Upload utility. The following code used to work correctly. However, I lost my database and had to rebuild. Does anyone have any suggestions on what I may have wrong. I am not sure if I built my table to store the picture id's correctly. Maybe a field type or something. <form name="UpdatePropertyPicture" method="POST"...
2
5174
dlite922
by: dlite922 | last post by:
I have an intranet LAMP server and I use PHP to upload files. It is of course faster to download the same file than to upload it. I understand ISPs throttle their network for download speed, than upload since most people download from the internet vs upload. My question is if it's a local intranet with a couple of users, why is it faster to download the same exact file vs when I uploaded it a minute ago. Does it have to do with HTTP...
0
8402
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8315
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8829
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8734
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8608
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5633
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2733
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1962
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1627
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.