Thanks for the link and the sample code, Paulo.

And to clarify my last statement, you use WSE with .NET to enable DIME
attachments. (Standard .NET doesn't support attachments.)

See also this paper by Steve.
http://www.mail-archive.com/[EMAIL PROTECTED]/msg08732/Fear_of_Attach
ments.pdf

Anne 

-----Original Message-----
From: Paulo Soares [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 12, 2004 1:01 PM
To: [EMAIL PROTECTED]
Subject: RE: Attachments Axis and .NET

See http://marc.theaimsgroup.com/?l=axis-user&m=108247433123185&w=2

For C# the code would be (it's for other service but you'll get the
idea):

            localhost1.fileserveService filese = new
localhost1.fileserveService();
            localhost1.FileAttributes[] fa =
filese.getAttributesAllDir("this dir");
            localhost.valida_cartaoService service = new
WindowsServiceCSharp.localhost.valida_cartaoService();
            service.RequestSoapContext.Path.MustUnderstand = false;
            DimeAttachment dime = new DimeAttachment("application/pdf",
TypeFormatEnum.MediaType, new FileStream("c:\\angebot4.pdf",
FileMode.Open, FileAccess.Read));
            service.RequestSoapContext.Attachments.Add(dime);
            string[] ss = service.valida("qualquer", 3.66f, 445);
            int n = service.ResponseSoapContext.Attachments.Count;
            for (int k = 0; k < n; ++k) {
                FileStream fs = new FileStream("c:\\attaxis" + k,
FileMode.Create, FileAccess.Write);
                byte[] buf = new byte[4192];
                int nn;
                while ((nn =
service.ResponseSoapContext.Attachments[k].Stream.Read(buf, 0,
buf.Length)) > 0) {
                    fs.Write(buf, 0, nn);
                }
                fs.Close();
            }
            foreach (string s in ss)
                System.Console.Out.WriteLine(s);
            return;


Don't forget to derive your service from
Microsoft.Web.Services.WebServicesClientProtocol.

Best Regards,
Paulo Soares

> -----Original Message-----
> From: Andrew Premdas [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, May 12, 2004 5:35 PM
> To: [EMAIL PROTECTED]
> Subject: RE: Attachments Axis and .NET
> 
> Anne,
> 
> Thanks for reply, could you expand a little on it, or add a pointer to
> something explaining what using the .NET WSE package with 
> Axis involves.
> 
> Many thanks
> 
> Andrew
> 
> -----Original Message-----
> From: Anne Thomas Manes [mailto:[EMAIL PROTECTED]
> Sent: 12 May 2004 16:30
> To: [EMAIL PROTECTED]
> Subject: RE: Attachments Axis and .NET
> 
> 
> DIME attachments work. You need to use the .NET WSE package to use
> attachments.
> 
> -----Original Message-----
> From: Andrew Premdas [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, May 12, 2004 10:00 AM
> To: [EMAIL PROTECTED]
> Subject: Attachments Axis and .NET
> 
> Hi,
> 
> I'm an Axis newbie struggling away not very successfully at 
> the moment :(
> 
> What I want to do is create a range of services that send 
> images. I was
> hoping to use Axis as the server, java code as the provider 
> and to be able
> to send the images using attachments to both .NET clients and 
> other clients.
> The images are in a database.
> 
> Services envisaged
> 
> getMyPhoto(String myId) returns a gif
> getPhotos(String[] ids) returns perhaps a zip file of gif's
> 
> Anyhow I've read that there are problems with attachments 
> from Axis to .NET,
> is this still true? Am I going about things in the right way? 
> Finally could
> anyone point me to resources that might help in this particular task.
> 
> All best
> 
> Andrew
> 
> 
> 

Reply via email to