Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

xsd:base64Binary vs Datahandler

843833Apr 10 2009 — edited Apr 10 2009
Hi There,
I was developing a webservice using top down approach( wsdl to java). So in one of my complex types, I defined an element type as xsd:base64Binary( in wsdl file)
<xsd:element minOccurs="1" maxOccurs="1" name="token" type="xsd:base64Binary"/>

When I convert this wsdl to java, a java class for this complex type will be created and the type of token is javax.activation.DataHandler.

So in serverside if I have a byte array, how will I convert that to a valid javax.activation.DataHandler object and vice versa in client side?

I hope I have provided enough info here to understand the issue. Please feel free to ask otherwise.

Thanks,
Jose John

Comments

jtahlborn
annoyingly, this is not as easy as it should be. basically, you need to wrap the byte[] in a ByteArrayInputStream, and wrap that in an instance of a DataSource which returns this stream from the getInputStream method (and then wrap the DataSource in a DataHandler). there may be some internal sun classes which simplify this (something like ByteArrayDataSource), but i'm not sure.
1 - 1
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on May 8 2009
Added on Apr 10 2009
1 comment
883 views