Here are GetFile and PutFile methods I did for WSE awhile ago. hth.
[SoapMethod("http://abc.com/2004/07/GetFile")]
public long GetFile(string path)
{
try
{
SoapContext rescx = ResponseSoapContext.Current;
DimeAttachment dimeAttach = new DimeAttachment(
"application/file", TypeFormat.MediaType, path);
rescx.Attachments.Add(dimeAttach);
return dimeAttach.Stream.Length;
}
catch
{
return -1;
}
}
[SoapMethod("http://abc.com/2004/07/PutFile")]
public long PutFile(string path)
{
try
{
SoapContext ctx = RequestSoapContext.Current;
if (ctx == null)
return -1;
if ( path == null )
return -1;
// Check for one attachment.
if (ctx.Attachments.Count != 1 )
return -1;
Stream stream = ctx.Attachments[0].Stream;
long len = stream.Length;
WriteFileFromStream(stream, path);
return len;
}
catch
{
return -1;
}
}
--
William Stacey, MVP
"Vai2000" <no****@microsoft.com> wrote in message
news:ed**************@TK2MSFTNGP10.phx.gbl...
Thanks Rick, Problem is how do I send attachment to the WS? This is what
I am attempting.....
private void Button1_Click(object sender, System.EventArgs e)
{
// load the file
// send it as dime attachment
SoapContext soapContext = HttpSoapContext.ResponseContext;
DimeAttachment dimeAttachment = new DimeAttachment("plain/text",
(TypeFormatEnum)16, strFullPath);
dimeAttachment.Id = "uri:" + Guid.NewGuid().ToString();
soapContext.Attachments.Add(dimeAttachment);
/// >>>> how should I call WS ????
service1 svc=new service1();
svc.UploadDimAttach();
}
Whats the latest then...?
"Richard" <Ri*****@discussions.microsoft.com> wrote in message
news:DC**********************************@microsof t.com...
I did this about a year ago... You need WSE {Web Service Enhancements} and you attach the DIME attachment to the httprequest - I forget the
specifics...
BUT - be advised that DIME is dead; Microsoft is not pushing it any
longer...
--Richard
"Vai2000" wrote:
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 5-20MB!!!!
Q1. How do I send DIME attachments to the WebSvc from my Portal?
TIA