'Loading Photo to LDAP Via MuleSoft Java module [closed]

There might be a silly mistake am doing it. but am trying to load a jpeg photo to ldap via java and facing small issue.

Currently in mule-3 we use invoke java and store it in ldap and when we download from ldap we get actual image. this is how its getting stored

enter image description here

and here is high level java code

enter image description here

In Mule-4 there is no event context and java module itself got changed. so am using similar java program and trying to load to ldap. its getting loaded but when i download its not an image.

this is how its storing in ldap, some extra content in the beginning it seems. below is my java code

enter image description here

enter image description here

     %dw 2.0
    import java!imaging::UploadPhotoToAD
    import * from dw::core::Binaries
    import * from dw::core::Numbers
output application/java
---
UploadPhotoToAD::updateEntry(ldap.image as Binary, ldap.userDN, ldap.usersDN, ldap.url, ldap.authDN, ldap.authPassword)

Any idea what am missing here or anything needs to be changed



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source