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

Reply via email to