Skip to main content


Message Broker’s ASBITSTREAM function

I recently had a unique integration requirement where an external service provider was expecting XML within the SOAP request. One automatically thinks CDATA but in this case the endpoint required the XML to be escaped within a SOAP request.

<SOAP-ENV:Envelope xmlns:SOAP-ENV="" xmlns:ns1="">
  <ns1:Value>&lt;order&gt; &lt;ns1:Attributes&gt; &lt;ns1:Name&gt;Transaction_ID&lt;/ns1:Name&gt;&lt;ns1:Value&gt;Transaction_ID goes here&lt;/ns1:Value&gt; &lt;/ns1:Attributes&gt; &lt;/order&gt;

After multiple attempts trying to solve this with XSLT’s a colleague suggested why not move back to ESQL and use the ASBITSTREAM function. A few minutes later the below ESQL snippet proves once again why Message Broker is a true Enterprise ESB.

SET soapReq.ns:Objects.ns:Subscribers.ns:Attributes[1].ns:Name='XML_Data';
 SET myMsgBlob = ASBITSTREAM(InputRoot.XMLNSC.Order, 
                                       FolderBitStream );
  SET myMsgChar = CAST( myMsgBlob AS CHAR CCSID InputRoot.Properties.CodedCharSetId ENCODING InputRoot.MQMD.Encoding); 
 SET soapReq.ns:Objects.ns:Subscribers.ns:Attributes[1].ns:Value = myMsgChar;

IBM / Red Hat - Unlock Potential App Modernization
Unlock Your Potential with Application Modernization

Application modernization is a growing area of focus for enterprises. If you’re considering this path to cloud adoption, this guide explores considerations for the best approach – cloud native or legacy migration – and more.

Get the Guide


What’s next?

If you’re still using WebSphere Message Broker, it might be time to think about upgrading your ESB. Whether you’re using an unsupported version of WMB or want the features of the newest IIB release, use our best practices compiled over the course of countless migrations to ease the process and maximize your IBM investment.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Arnold Shoon

Solutions Director with 10+ years focused on IBM based large enterprise SOA solutions.

More from this Author

Follow Us