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: kath...@wso2.com
mobile: +94772596173
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to