471,071 Members | 1,516 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,071 software developers and data experts.

Dime doubt

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

Nov 16 '05 #1
3 3376
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

Nov 16 '05 #2
Thank you my friend!!

"Richard" <Ri*****@discussions.microsoft.com> wrote in message
news:2E**********************************@microsof t.com...
Told you it was a year ago --> I meant SOAPContext...

Anyway file size is not an issue. Max DIME record size is either 64K or 4gig {I forget which} and I do not believe there is a limit on num records
per DIME attachment. I also do not believe there is a limit on the number
of DIME attachments per message {I was doing 0-n attachments of 2-10 meg per
attachment with no troubles over a high bandwidth connection}. The only
issue with 5-20meg files is how long users want to wait while upload is in
progress... Other caveats:
1) You have to call a method on the service after you have attached everything to the context because the method call is when files are loaded
and bytes move across the wire. As far as actually moving bytes, if I
recall DIME will load the file content into 1 or more records as needed...
2) You have to send the ids of your attachments along with the request so that you can retrieve the attachment by id on the server side; anything can
be an id - string GUIDS or filenames are fine - so long as it is unique per
request.
Anyway, when you wish to send you must attach the file blob to the context of your instantiated service as that context is what is packaged up and
shipped along with any requests to your service. Also you

SendBLOBToWS()
{
// instantiate WS
service1 svc=new service1();

// create attachment
DimeAttachment attachment = new DimeAttachment("application/octet-stream", TypeFormatEnum.MediaType, strFullPath)
// assure a unique id for this attachment
attachment.id = <<whatever>>

// connect attachment to WS context
svc.RequestSoapContext.Attachments(attachment);

// piggy-back file blob on any request to WS
svc.CallAnyMethod(attachment.id);
}

-------------------------------------------------------

Server side is:

Service1.CallAnyMethod(string id)
{
DimeAttachment attachment = HttpSoapContext.RequestContext.Attachments[id]; ...
int ch = 0;
while ((ch = attachment.Stream.ReadByte()) != -1)
{
...
}
...
}

--Richard

"Vai2000" wrote:
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
>
>
>
>


Nov 16 '05 #3
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



Nov 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Eric Lavitsky | last post: by
reply views Thread by Willem | last post: by
reply views Thread by LearninGuru | last post: by
1 post views Thread by Modica82 | last post: by
1 post views Thread by Matt B | last post: by
3 posts views Thread by Matt B | last post: by
5 posts views Thread by =?Utf-8?B?SmFrb2IgTGl0aG5lcg==?= | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.