DIME Attachment from Client to Server

S

Senthil

hi,
I need to write an application which needs to transfer
a binary file from client to server. I will be able to
send it as DIME attachment along with the SOAP message.

This example which uses WS Attachments from Webservice to
Client
http://www.xmlforasp.net/codeSection.aspx?csID=96

Does anyone have idea about sending a DIME attachment
from client to a webservice.


Thanks
sendhil
 
E

Eric

It's similar to sending it from the web service to the client. Make sure
you modify the proxy class so that it derives from
Microsoft.Web.Services.WebServicesClientProtocol.

Client:
// Create instance of web service
wsUpload = new WSUpload.WSUpload();

// Create attachment from posted file stream
DimeAttachment da = new DimeAttachment("plain/text; charset=
utf-8",
TypeFormatEnum.MediaType,
hifUpload.PostedFile.InputStream);

// Add it and send it to the server
wsUpload.RequestSoapContext.Attachments.Add(da);

wsUpload.TransferFile();


Server:
// Get the stream and do something with it
StreamReader sr = new StreamReader(
HttpSoapContext.RequestContext.Attachments[0].Stream);
 
S

Scott McFadden

When I tested the DIME sample app it was more than twice as slow as just
sending a regular Soap based64 encode byte array. DIME is not ready for
prime time yet.

scottm

Eric said:
It's similar to sending it from the web service to the client. Make sure
you modify the proxy class so that it derives from
Microsoft.Web.Services.WebServicesClientProtocol.

Client:
// Create instance of web service
wsUpload = new WSUpload.WSUpload();

// Create attachment from posted file stream
DimeAttachment da = new DimeAttachment("plain/text; charset=
utf-8",
TypeFormatEnum.MediaType,
hifUpload.PostedFile.InputStream);

// Add it and send it to the server
wsUpload.RequestSoapContext.Attachments.Add(da);

wsUpload.TransferFile();


Server:
// Get the stream and do something with it
StreamReader sr = new StreamReader(
HttpSoapContext.RequestContext.Attachments[0].Stream);




Senthil said:
hi,
I need to write an application which needs to transfer
a binary file from client to server. I will be able to
send it as DIME attachment along with the SOAP message.

This example which uses WS Attachments from Webservice to
Client
http://www.xmlforasp.net/codeSection.aspx?csID=96

Does anyone have idea about sending a DIME attachment
from client to a webservice.


Thanks
sendhil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top