You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Br...@nokia.com on 2003/05/13 18:13:31 UTC

File upload example

Hello,

Does anyone have a sample of a web service and client call for doing a file upload using Axis?  

I have found samples for the old Apache Soap, but it seems that things are usually simpler when done with Axis.

Thanks,

Bruno

Re: File upload example

Posted by Praveen Peddi <pp...@contextmedia.com>.
Doesn't option 2 tie you to axis. What if u want to change from axis to
something else in the future. In that case you will have to re-write ur soap
service completely.

I think its better to keep your soap services transparent of tool apis. If
you adopt the first option and since DataHandler is part of activation api
(not axis api), you won't have to change your code at all even if u change
from axis to something else.

Praveen
----- Original Message -----
From: "Duane Gran" <dg...@spinweb.net>
To: <ax...@ws.apache.org>
Sent: Tuesday, May 13, 2003 1:22 PM
Subject: Re: File upload example


> Bruno,
>
> I cut my teeth on this one recently, so I'll be happy to share what I
> have.  From what I've seen, there are two typical ways of doing this
> from the client side:
>
> 1) Encode the attachment as a DataHandler, serialize it and send it as
> a parameter
> 2) Like above, encode as a DataHandler and put into an attachment (dime
> or mime)
>
> My code supports both ways, but at the moment I prefer #2.  Someone
> else may be able to shed more light, but it seems to have more promise
> for interoperability, but at this time my environment is Java-only, so
> that is just conjecture on my part.
>
> My application deals specifically with converting a binary file (MARC)
> into an XML format (MARCXML), so don't get hung up on the extraneous
> details.  In MarcXmlMapper the key parts to look at are the two convert
> methods and getAttachments.  The TextMarcXmlMapper is a JUnit test that
> loosely ensures that the connection was accepted and some manner of
> String data came back.  The test is pretty weak right now, but it will
> do.  I am including my wsdd file if that may be helpful.
>
> Feel free to email me if you have any questions.
>
> Duane
>
>
>


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


>
>
>
> On Tuesday, May 13, 2003, at 12:13  PM, <Br...@nokia.com> wrote:
>
> > Hello,
> >
> > Does anyone have a sample of a web service and client call for doing a
> > file upload using Axis?
> >
> > I have found samples for the old Apache Soap, but it seems that things
> > are usually simpler when done with Axis.
> >
> > Thanks,
> >
> > Bruno
>


Re: File upload example

Posted by Duane Gran <dg...@spinweb.net>.
Bruno,

I cut my teeth on this one recently, so I'll be happy to share what I 
have.  From what I've seen, there are two typical ways of doing this 
from the client side:

1) Encode the attachment as a DataHandler, serialize it and send it as 
a parameter
2) Like above, encode as a DataHandler and put into an attachment (dime 
or mime)

My code supports both ways, but at the moment I prefer #2.  Someone 
else may be able to shed more light, but it seems to have more promise 
for interoperability, but at this time my environment is Java-only, so 
that is just conjecture on my part.

My application deals specifically with converting a binary file (MARC) 
into an XML format (MARCXML), so don't get hung up on the extraneous 
details.  In MarcXmlMapper the key parts to look at are the two convert 
methods and getAttachments.  The TextMarcXmlMapper is a JUnit test that 
loosely ensures that the connection was accepted and some manner of 
String data came back.  The test is pretty weak right now, but it will 
do.  I am including my wsdd file if that may be helpful.

Feel free to email me if you have any questions.

Duane