Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-11-2008, 12:22 PM
Member
 
Join Date: Sep 2008
Posts: 1
afolli is on a distinguished road
Include Base64 encoded data into XML
Hello,
I have to base64 encode a large quantity of data and include it in the XML response of the webservice.The WSDL define the XML element in the following way:

<xs:complexType name="MessagePart">
<xs:simpleContent>
<xs:extension base="xs:base64Binary">
<xs:attribute name="contentType" type="xs:string" default="text/plain" use="optional"/>
<xs:attribute name="length" type="xs:int" default="0" use="optional"/>
<xs:attribute name="offset" type="xs:int" default="0" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>

I have implemented it but I have some doubts. I'm not sure it's the better way for doing it.

import org.apache.commons.codec.binary.Base64;
...

OMElement part = factory.createOMElement("part", emptyNs);
part.addAttribute("length", this.attachment.getLength(), null);
byte[] value = Base64.encodeBase64(this.attachment.getValue());
part.setText( new String(value) );


What about performance if I have an attachment of 1MB? I'm specially worried about the "new String()" operation.
Any suggestion will be appreciated. Thanks,

Alessandro
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to include lib in JAR file adam.muller Eclipse 4 08-06-2008 07:15 PM
jsp:include in a sql:transaction sam2020 JavaServer Pages (JSP) and JSTL 0 07-31-2008 10:11 PM
<jsp:include> Vs <%@include> Vs <jsp:forward> Vs RequestDispatcher .forward/includeVs freddieMaize Java Servlet 5 07-29-2008 04:13 PM
Reaing a UTF-8 encoded file mew New To Java 0 01-16-2008 07:09 PM
jsp:include and include file Heather JavaServer Pages (JSP) and JSTL 1 07-14-2007 06:19 PM


All times are GMT +3. The time now is 08:13 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org