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 Stuart Barlow <sb...@peopledoc.com> on 2004/04/09 12:06:20 UTC

Re: Byte arrays in SOAP attachments.

Is there any news on this one?

Joshua Scott Emmons wrote:
> This has been discussed here before, most completely at
> http://www.mail-archive.com/axis-user@xml.apache.org/msg12463.html
> but it seems we haven't been able to come to a resolve.
> 
> Can someone state definitively what the "proper" way to send byte arrays 
> in a soap attachment via axis is?
> 
> Everyone seems to agree that a DataHandler should be used, but most 
> differ on how that DataHandler should be created.  The two main schools 
> of thought are:
> 
> public foo(byte[] bytes){
>     new DataHandler(bytes, "application/octet-stream");
> }
> 
> public bar(byte[] bytes){
>     DataSource ds = new OctetStreamDataSource(null, new 
> OctetStream(bytes));
>     new DataHandler(ds);
> }
> 
> foo() has the advantage of not requiring any axis-specific imports, 
> which should help interop. However, in Axis1.1, foo() throws an 
> exception whereas bar() does not.  There's been talk on the list that 
> this may be a bug, but no one has said for sure one way or another.
> 
> Seriously, folks, how are we supposed to send byte arrays?
> 
> Cheers,
> -Josh Emmons
> 
> 


Re: Byte arrays in SOAP attachments.

Posted by Davanum Srinivas <di...@yahoo.com>.
does both foo() and bar() work with 1.2Beta? If either fails, please open a bug report. 

thanks,
dims

--- Stuart Barlow <sb...@peopledoc.com> wrote:
> Is there any news on this one?
> 
> Joshua Scott Emmons wrote:
> > This has been discussed here before, most completely at
> > http://www.mail-archive.com/axis-user@xml.apache.org/msg12463.html
> > but it seems we haven't been able to come to a resolve.
> > 
> > Can someone state definitively what the "proper" way to send byte arrays 
> > in a soap attachment via axis is?
> > 
> > Everyone seems to agree that a DataHandler should be used, but most 
> > differ on how that DataHandler should be created.  The two main schools 
> > of thought are:
> > 
> > public foo(byte[] bytes){
> >     new DataHandler(bytes, "application/octet-stream");
> > }
> > 
> > public bar(byte[] bytes){
> >     DataSource ds = new OctetStreamDataSource(null, new 
> > OctetStream(bytes));
> >     new DataHandler(ds);
> > }
> > 
> > foo() has the advantage of not requiring any axis-specific imports, 
> > which should help interop. However, in Axis1.1, foo() throws an 
> > exception whereas bar() does not.  There's been talk on the list that 
> > this may be a bug, but no one has said for sure one way or another.
> > 
> > Seriously, folks, how are we supposed to send byte arrays?
> > 
> > Cheers,
> > -Josh Emmons
> > 
> > 
> 


=====
Davanum Srinivas - http://webservices.apache.org/~dims/