-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: krisnss
Message 2 in Discussion
Hi,
you can take advantage of WSE 2.0 DIME Support or WSE 3.0 MTOM support for
file transfers. Here i am giving you the sample code with DIME:
Write a Client Application to upload a file as:
dimeproxy.DIMEService dimeObj = new dimeproxy.DIMEService();
System.IO.Stream ioStream = File.Open( filePath,FileMode.Open);
dimeObj.RequestSoapContext.Attachments.Add(new DimeAttachment ("text/xml",
extension,TypeFormat.MediaType,ioStream));
dimeObj.WriteToFile(fileWithExt);
ioStream.Close();
Note: Here WriteToFile() is a web method which will take a file stream from
client. So you have to write a web service on Server side as follows:
Write a Service Application to get a file as:
SoapContext context = RequestSoapContext.Current;
if( context.Attachments.Count > 0)
{
string locationToWrite = Server.MapPath("Data/" + fileToWrite);
FileStream fStream = new
FileStream(locationToWrite,FileMode.Create,FileAccess.Write);
int fileLength = (int)context.Attachments[0].Stream.Length;
byte[] buffer = new byte[fileLength];
context.Attachments[0].Stream.Read(buffer,0,fileLength);
fStream.Write(buffer,0,fileLength);
fStream.Close();
}
Thats all. I hope this is what your requirement. If you have any queries
regarding this, feel free to ask me.
Regards,
Krishna NSS
>From: "Ravikumarcbe" <[EMAIL PROTECTED]>
>Reply-To: "BDOTNET" <[email protected]>
>To: "BDOTNET" <[email protected]>
>Subject: Web service Attachment - MIME
>Date: Tue, 9 May 2006 19:50:49 -0700
>
>
>
>
>
>
>
>
>
>
>
>
> New Message on BDOTNET
>
>
>
>
>
>
>
> Web service Attachment - MIME
>
>
>
>
> Reply
>
>
>
>
>
> Reply to Sender
> Recommend
>
> Message 1 in Discussion
>
>
>
>
>
>
>
> From:
> Ravikumarcbe
>
>
>
>
> Hi, Anybody know how to send attachment thru web
>service as MIME format?. As far as I know DIME is supported by only MS. If
>anybody have any sample code...? Thanks in advance Regards, Ravi
>
>
>
>
>
>
> View other groups in this category.
>
>
>
>
>
>
>
>
>
>
>
>
>
>Also on MSN:
>Start Chatting | Listen to Music | House & Home | Try Online Dating | Daily
>Horoscopes
>
>
>
>
>
>
>
>
>
>
> To stop getting this e-mail, or change how often it
>arrives, go to your E-mail Settings.
>
>
> Need help? If you've forgotten your password,
> please go
>to Passport Member Services.
>
> For other questions or feedback, go to our
> Contact Us
>page.
>
>
> If you do not want to receive future e-mail
> from this
>MSN group, or if you received this message by mistake, please click the
>"Remove" link below. On the pre-addressed e-mail message that opens, simply
>click "Send". Your e-mail address will be deleted from this group's mailing
>list.
>
>
> Remove my e-mail address from BDOTNET.
>
>
>
>
>
>
>
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you
received this message by mistake, please click the "Remove" link below. On the
pre-addressed e-mail message that opens, simply click "Send". Your e-mail
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]