|
what is the best way to send an arbitrary file through webservices?
(I think transforming it to an array of bytes is not a good idea...)
|
|
|
|
|
I would say array of bytes is good enough, actually file is exactly that: array of bytes. You don't have to transform anything, just load your file from FileStream into byte array.
check this article, maybe it helps you:
http://www.codeproject.com/vb/net/wsfileserver.asp
Pilo
|
|
|
|
|
Thank you for the answer, when I said "transform" I meant "load" but when passing through the webservices an array of bytes will be transformed to some xml-data, something like this: (array)(byte)1(/byte)(byte)2(/byte)(/array)
This data contains a lot of unnecessary information (repeated "byte" nodes).
Are there any techinques to send the file in more compact format that needs less memory size?
|
|
|
|
|
I think WCF is the solution for you. WCF supports Large Message Transfer. If you want to use Http protocol, you need to use wsHttpBinding (design to supports SOAP 1.2 standard; amsx web service is SOAP 1.1 standard). To support Large Message Transfer, you can set messageEncoding to MTOM (MTOM stands for Message Transmission Optimization Mechanism). You also need to adjust the maxReceiveMessageSize and maxReceiveMessageSize of the binding because the default is not very large.
petersgyoung
|
|
|
|
|
But WCF is a part of .NET 3.0. Are there any methods to do this using .NET 2.0?
|
|
|
|
|
If you want to stick to older technology, you can try WSE (Web Service Enhancement). If I remember correctly, WSE is an add-in which makes SOAP with Attachments (SwA) and Direct Internet Message Encapsulation(DIME) possible on older framework, e.g. .Net 1.1. I, however, do not recommend you to learn phasing out technology. SwA and DIME are now replaced by MTOM.
petersgyoung
|
|
|
|
|
Ok, thank you, I'll think about this
|
|
|
|
|
Strictly speaking, you can't send a file through webservices, you can only send the data in the file.
If you can't assume anything about the content of the file, a byte array is the only way that you can represent the data in the file. You can then convert the bytes to anything you like, for example a Base64 string, but there is no way around the byte array.
---
single minded; short sighted; long gone;
|
|
|
|
|
I understand that I can send only the data in the file. The question is how to represent this data for transfering through webservices? I want the memory size of my file data to be as small as it can be. For example, if I have an array of bytes, data that passes through webservices should look like this: (array)(byte)1(/byte)(byte)2(/byte)(/array). And it's not very good, because "byte" xml-nodes are repeated too often. And the string representation causes some problems with encodings.
|
|
|
|
|
You can turn it into a Base64 string using the Convert.ToBase64String method, and convert it back to a byte array using the Convert.FromBase64String .
The Base64 encoding stores 6 bits in each character, which gives you an overhead of only 33%.
---
single minded; short sighted; long gone;
|
|
|
|
|
But 2 bits will be lost, won't they? (I am not strong in encodings...)
|
|
|
|
|
steve_a_p wrote: But 2 bits will be lost, won't they?
Of course not, that would be pointless. All the bits are distributed across characters. Three bytes (3*8 bits) are stored in four characters (4*6 bits).
---
single minded; short sighted; long gone;
|
|
|
|
|
I don't know, may be there is some special stream for sending file data from client to server at once, isn't there?
-- modified at 5:09 Friday 31st August, 2007
|
|
|
|
|
I am currently implementing some search engine optimisation accross a large site. The site has a single master page that handles all of the pages. Obviously within each page I can set the pages title using
Master.Page.Title = "The title"
But when it comes to meta tags there are no available easy way's of tackling this, so i had planned to create some. As follows
<!-- BEGIN META TAGS --><br />
<meta id="MetaDescription" runat="server" name="Description" content="" /><br />
<!-- END META TAGS --><br />
As one tag
and then
Public Property MetaTagsDescription() As String<br />
Get<br />
Return MetaDescription.Attributes.Item("content")<br />
End Get<br />
Set(ByVal value As String)<br />
MetaDescription.Attributes.Add("content", value)<br />
End Set<br />
End Property
to create the get and set properties. My question is this. If I were to add another meta tag and create it's get and set properties how could I got about surrounding these two get and set section into a single meta tag property.
So I could do the following code in the page
Master.MetaTags.Description = "Hobo"<br />
Master.MetaTags.Title= "Hobo"
Any help on this one is much appreciated.
|
|
|
|
|
CongfigurationErrorsException
An error occurred creating the configuration section handler for dataConfiguration: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Data, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) (D:\WebSite2\web.config line 12)
Hi my code runs fine when I don't use MSEnterpriseLibarary 3.1 Configuration tool and simply adding the reference to the dlls, But the same when I want to do with MSEnterpriseLibarary 3.1 configuration tool I am getting the Above Exception.
As I am new to using the tool may I am missing something important....
Help needed ....
Thanks in advance
|
|
|
|
|
Did you have any previous versions installed? Sounds like a version conflict. Try removing all instances of EL and reinstalling.
only two letters away from being an asset
|
|
|
|
|
Thanks But Suggestion didn.t worked
|
|
|
|
|
Hello,
How to send the email to a list of users like Newsletter........in ASP.NET
Thnx
|
|
|
|
|
foreach(User in Users)
{
MailMessage.To = User.Email;
MailMessage.Body = ...
}
or
MailMessage.Body = ...
foreach(User in Users)
{
MailMessage.To = User.Email;
}
only two letters away from being an asset
|
|
|
|
|
Hello,
I want to set javascript variable value to session variable in javascript.
I am able to get Session Variable value to javascript variable
as,
<%string str="s2345";Session["Resolution"]=str;%>
var Id=('<%=Session["Resolution"]%>');
But I want to set javascript variable value say screen.width to my Session Variable.
Please let me know if someone knows the way
Swapnil Bhavsar
|
|
|
|
|
swapnilbhavsar wrote: I want to set javascript variable value to session variable in javascript.
javascript runs on the client-side. session is a server-side object.
you can't set javascript variable value to Session Variable in javascript.
Regards J O H N
"Even eagles need a push." David McNally
|
|
|
|
|
You have to pass the javascript variable to the server somehow, and set the session variable there.
You can use AJAX methods, or some postback event to get the variable to the server.
only two letters away from being an asset
|
|
|
|
|
How to implement a class library in asp.net with code
|
|
|
|
|
1) Read How to get an answer to your question
2) Write the code
only two letters away from being an asset
|
|
|
|
|
Read this first and try to start practice some code.
SSK.
|
|
|
|