Here are GetFile and PutFile methods I did for WSE awhile ago. hth.
[SoapMethod("htt p://abc.com/2004/07/GetFile")]
public long GetFile(string path)
{
try
{
SoapContext rescx = ResponseSoapCon text.Current;
DimeAttachment dimeAttach = new DimeAttachment(
"applicatio n/file", TypeFormat.Medi aType, path);
rescx.Attachmen ts.Add(dimeAtta ch);
return dimeAttach.Stre am.Length;
}
catch
{
return -1;
}
}
[SoapMethod("htt p://abc.com/2004/07/PutFile")]
public long PutFile(string path)
{
try
{
SoapContext ctx = RequestSoapCont ext.Current;
if (ctx == null)
return -1;
if ( path == null )
return -1;
// Check for one attachment.
if (ctx.Attachment s.Count != 1 )
return -1;
Stream stream = ctx.Attachments[0].Stream;
long len = stream.Length;
WriteFileFromSt ream(stream, path);
return len;
}
catch
{
return -1;
}
}
--
William Stacey, MVP
"Vai2000" <no****@microso ft.com> wrote in message
news:ed******** ******@TK2MSFTN GP10.phx.gbl...
Thanks Rick, Problem is how do I send attachment to the WS? This is what
I am attempting.....
private void Button1_Click(o bject sender, System.EventArg s e)
{
// load the file
// send it as dime attachment
SoapContext soapContext = HttpSoapContext .ResponseContex t;
DimeAttachment dimeAttachment = new DimeAttachment( "plain/text",
(TypeFormatEnum )16, strFullPath);
dimeAttachment. Id = "uri:" + Guid.NewGuid(). ToString();
soapContext.Att achments.Add(di meAttachment);
/// >>>> how should I call WS ????
service1 svc=new service1();
svc.UploadDimAt tach();
}
Whats the latest then...?
"Richard" <Ri*****@discus sions.microsoft .com> wrote in message
news:DC******** *************** ***********@mic rosoft.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