axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fran <fcocuadr...@gmail.com>
Subject Re: [AXIS2] How to manage byte[] using ADB?
Date Mon, 21 May 2007 17:05:50 GMT
2007/5/21, Paul Fremantle <pzfreo@gmail.com>:
> No problem!
>
> The DataHandler is an abstraction over a byte array or file. The
> reason is that you might have a very large binary data object (maybe a
> file) and you don't want to load the whole thing into memory. The
> DataHandler object lets Axis2 stream such large objects straight from
> file to the network without having to load the whole byte[] in memory
> at once.
>
> But in your case I'm guessing its ok to have a byte[], so here is what
> you need to do.
>
> To create a DataHandler from a byte[], just do:
>
> import org.apache.axiom.attachments.ByteArrayDataSource;
>
> DataHandler dh = new DataHandler(new ByteArrayDataSource(yourByteArray))
>

And to get the content of a DataHandler into a byte array?

> Alternatively, if you know the data type of the binary data (e.g.
> image), you can mark up the schema using
>
>    <element name="MyBinaryData"
> xmime:expectedContentTypes='image/jpeg' type="xmime:base64Binary"/>
>
> This will trigger the ADB databinding tool to recognize this as an
> image and map it into a java.awt.Image.
>
> Its worth reading: http://ws.apache.org/axis2/1_2/mtom-guide.html
>
> Paul
>
> On 5/21/07, Fran <fcocuadrado@gmail.com> wrote:
> > Hi!
> >
> > I've got a web service that send/receive byte[] in some methods, I'm
> > using ADB and I have done a WSDL and Skeleton for my service, but I
> > don't know how get/set byte[] in the parameters of my methods, I see
> > that byte[] is transformed in DataHandler but I don't know how to
> > interact with DataHandler.
> >
> > Can anyone help me?
> >
> > Thanks!
> >
> > PS: Sorry for my poor English.
> >
> > --
> > Saludos
> >
> > Fran
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
>
>
> --
> Paul Fremantle
> VP/Technology, WSO2 and OASIS WS-RX TC Co-chair
>
> http://bloglines.com/blog/paulfremantle
> paul@wso2.com
>
> "Oxygenating the Web Service Platform", www.wso2.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Saludos

Fran

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Mime
View raw message