2
votes

Getting PDF Attachment from Salesforce as base64 format using Mulesoft like below: toBase64(payload as Binary)

But when sending the same payload to NetSuite as File content, giving error. Sending as : write(fromBase64(acc.Body as String) as Binary,"application/octet-stream" )

Error:Failed to convert property value of type 'org.mule.weave.v2.io.ByteArraySeekableStream' to required type 'byte[]' for property 'content'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type 'org.mule.weave.v2.io.ByteArraySeekableStream' to required type 'byte' for property 'content[0]': PropertyEditor [org.springframework.beans.propertyeditors.CustomNumberEditor] returned inappropriate value of type 'org.mule.weave.v2.io.ByteArraySeekableStream'.

Any Ideas how to convert base64 to byte[] ?

1

1 Answers

5
votes

You can use the class metadata hint to let data weave java writer know that you want the binary represented as byte[]

 output application/java
 ---
 fromBase64(acc.Body as String) as Binary {class: "byte[]"}