Gets the bitstream representation of the specified element. The parser associated with the element serializes the element and all its children. The result is copied to memory allocated by the caller. You can call this function only on the message body, that is, the last child of the message root. In the special case where all options specified match those of the original bitstream, for example, a bitstream read from a WebSphere MQ queue by the MQInput node, and the message has not been modified since receiving the original bitstream, this original bitstream is copied into the memory allocated by the user. In this case, the parser is not required to parse and re-serialize the message.
CciSize cniElementAsBitstream( int* returnCode, CciElement* element, const struct CciByteArray* value, CciChar* messageType, CciChar* messageSet, CciChar* messageFormat, int encoding, int ccsid, int options);
In this example, the node queries the properties folder to determine the messageSet, messageType, messageFormat, encoding, and bitstream. It then uses this information to get the bitstream representation of the message body.
inRootElement=cniRootElement(&rc, message); checkRC(rc); inBodyRoot = cniLastChild(&rc, inRootElement); checkRC(rc); inMQMD = cniSearchFirstChild(&rc, inRootElement, CCI_COMPARE_MODE_NAME, 0, CciString("MQMD",BIP_DEF_COMP_CCSID)); checkRC(rc); inPropertiesFolder =cniSearchFirstChild(&rc, inRootElement, CCI_COMPARE_MODE_NAME, 0, CciString("Properties",BIP_DEF_COMP_CCSID)); checkRC(rc); encodingElement = cniSearchFirstChild(&rc, inPropertiesFolder, CCI_COMPARE_MODE_NAME, 0, CciString("Encoding",BIP_DEF_COMP_CCSID)); checkRC(rc); ccsidElement = cniSearchFirstChild(&rc, inPropertiesFolder, CCI_COMPARE_MODE_NAME, 0, CciString("CodedCharSetId",BIP_DEF_COMP_CCSID)); checkRC(rc); messageSetElement = cniSearchFirstChild(&rc, inPropertiesFolder, CCI_COMPARE_MODE_NAME, 0, CciString("MessageSet",BIP_DEF_COMP_CCSID)); checkRC(rc); messageTypeElement = cniSearchFirstChild(&rc, inPropertiesFolder, CCI_COMPARE_MODE_NAME, 0, CciString("MessageType",BIP_DEF_COMP_CCSID)); checkRC(rc); messageFormatElement = cniSearchFirstChild(&rc, inPropertiesFolder, CCI_COMPARE_MODE_NAME, 0, CciString("MessageFormat",BIP_DEF_COMP_CCSID)); checkRC(rc); encoding = cniElementIntegerValue(&rc, encodingElement); checkRC(rc); ccsid = cniElementIntegerValue(&rc, ccsidElement); checkRC(rc); messageSetLength=512; messageSet = (CciChar*)malloc(messageSetLength * sizeof(CciChar)); messageSetLength = cniElementCharacterValue(&rc, messageSetElement, messageSet, messageSetLength); checkRC(rc); messageTypeLength=512; messageType = (CciChar*)malloc(messageTypeLength * sizeof(CciChar)); messageTypeLength = cniElementCharacterValue(&rc, messageTypeElement, messageType, messageTypeLength); checkRC(rc); messageFormatLength=512; messageFormat = (CciChar*)malloc(messageFormatLength * sizeof(CciChar)); messageFormatLength = cniElementCharacterValue(&rc, messageFormatElement, messageFormat, messageFormatLength); checkRC(rc); bitstream.size=512; bitstream.pointer=(CciByte*)malloc(sizeof(CciByte) * 512); bufLength = cniElementAsBitstream(&rc, inBodyRoot, &bitstream, messageType, messageSet, messageFormat, encoding, ccsid, 0); checkRC(rc); bitstream.size=bufLength; convertMessage(&bitstream.pointer, &bitstream.size);
Notices |
Trademarks |
Downloads |
Library |
Support |
Feedback
![]() ![]() |
as07885_ |