Tuesday, February 17, 2009

WTF is up with native in BPEL

To anyone that has tried to play around with BPEL they quickly realize that if a partnerlink has a schema of type "Native" than the payload must be in a Base64Binary string. This means that without a schema you can't just assign a string to a native payload. This is so that non-text content (such as pictures or audio) can be sent to a partnerlink, however, it creates extra work and aggravation 99% of the time.

So the easiest way to remedy this problem is to create a embedded java in your BPEL to convert your variable to a string. This post is designed to walk you through that.

First we need to import the Binary encoder so right before all of the partnerlinks in our BPEL document we will want to add this import (This is for Oracle BPEL and the class maybe different for other flavors)


Depending on the direction you want to go.

Ok now we have our import now we need to create a variable to house our encoded string, I used...

Finally we will create our embedded Java, here is what mine looks like I encoded my string decoding would be similar.
String input = (String)getVariableData();
Base64Encoder Encoder = new Base64Encoder();

String encoded = Base64Encoder.encode(input);
catch(Exception ex)

my is "ReceiveAddToDb_Dequeue_InputVariable","genericMessage","/ns6:genericMessage/ns6:payload"

Then I use an assign to assign the variable to the native payload.

No comments: