Hi, You can also try [1] for encoding.
[1] http://svn.wso2.org/repos/wso2/carbon/kernel/branches/4.2.0/patches/patch0001/dependencies/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/base64/Base64Utils.java On Thu, Dec 18, 2014 at 8:09 AM, Prabath Ariyarathna <[email protected]> wrote: > > HI Kathees. > > Please try to *Base64.encodeBase64URLSafeString(bytes)* instead of > *Base64.encodeBytes(bytes)* > > On Thu, Dec 18, 2014 at 7:46 AM, Kathees Rajendram <[email protected]> > wrote: > >> Hi, >> >> I tried to get the attachment from the axis2 message context and >> converted to base64 encoding. The base64 encoding is different compared >> with original image base64 encoding. Suggestion please? >> >> try { >> >> Axis2MessageContext axisMsgContext = (Axis2MessageContext) synCtx; >> org.apache.axis2.context.MessageContext msgContext = axisMsgContext >> .getAxis2MessageContext(); >> >> Attachments attachment = msgContext.getAttachmentMap(); >> >> InputStream inputStream = >> attachment.getIncomingAttachmentsAsSingleStream(); >> >> byte[] bytes = IOUtils.toByteArray(inputStream); >> >> String byteArray = Base64.encodeBytes(bytes); >> >> String encodedString = new String(byteArray); >> >> synCtx.setProperty("attachmentObject", encodedString); >> >> } >> >> Thanks, >> Kathees >> >> -- >> Kathees >> Software Engineer, >> email: [email protected] >> mobile: +94772596173 >> >> _______________________________________________ >> Dev mailing list >> [email protected] >> http://wso2.org/cgi-bin/mailman/listinfo/dev >> >> > > -- > > *Prabath Ariyarathna* > > *Associate Technical Lead* > > *WSO2, Inc. * > > *lean . enterprise . middleware * > > > *Email: [email protected] <[email protected]>* > > *Blog: http://prabu-lk.blogspot.com <http://prabu-lk.blogspot.com>* > > *Flicker : https://www.flickr.com/photos/47759189@N08 > <https://www.flickr.com/photos/47759189@N08>* > > *Mobile: +94 77 699 4730 * > > > > > > > _______________________________________________ > Dev mailing list > [email protected] > http://wso2.org/cgi-bin/mailman/listinfo/dev > > -- Best Regards, Malaka Silva Senior Tech Lead M: +94 777 219 791 Tel : 94 11 214 5345 Fax :94 11 2145300 Skype : malaka.sampath.silva LinkedIn : http://www.linkedin.com/pub/malaka-silva/6/33/77 Blog : http://mrmalakasilva.blogspot.com/ WSO2, Inc. lean . enterprise . middleware http://www.wso2.com/ http://www.wso2.com/about/team/malaka-silva/ <http://wso2.com/about/team/malaka-silva/> Save a tree -Conserve nature & Save the world for your future. Print this email only if it is absolutely necessary.
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
