While mapping the streamReference to opaque element in Oracle Integration you might get the “BASE64Decoder: Error in encoded stream: needed at least 2 valid base64 characters, but only got 0 before padding character (=), the 10 most recent characters were: “Sua1HdwQ==” the error.

Following is the complete error detail you may see in the error stack trace:

Error Summary: oracle.fabric.common.FabricInvocationException: oracle.soa.api.invocation.InvocationException: faultName: {{http://schemas.oracle.com/bpel/extension}runtimeFault}
messageType: {{http://schemas.oracle.com/bpel/extension}RuntimeFaultMessage}
parts: {{
summary=<summary>ORABPEL-11101
</summary>
,code=<code>java.lang.RuntimeException</code>
,detail=<detail>BASE64Decoder: Error in encoded stream: needed at least 2 valid base64 characters, but only got 0 before padding character (=), the 10 most recent characters were: "Sua1HdwQ=="</detail>}
cause: {BASE64Decoder: Error in encoded stream: needed at least 2 valid base64 characters, but only got 0 before padding character (=), the 10 most recent characters were: "Sua1HdwQ=="}

Issue: The issue is because you are trying to map the stringReference to an opaque element as is without doing converting it into the base64.

Solution: To solve this error, you need to use encodeReferenceToBase64 function in the mapper as shown in the following image:

After using this conversion, your integration will work like a charm.

Request you to subscribe to my YouTube channel for regular updates.

Further readings:

OSS-005: Unable to test the connection: OCI Streaming

Integrating Oracle Integration with API GW

Merge two different schema files into a single CSV file in Oracle Integration

How to create an Oracle APEX service

Insert data into a table using SQL in Oracle APEX

Form region to insert a record into a table in Oracle APEX

Master-Detail Page in Oracle APEX

Cascading List of Values in Oracle APEX

Oracle APEX Interactive Grid with CRUD operation