I want to encode a msgkey attribute into a refresh message, and this msgkey is directly get from the request message. I use below way, but it will effect the refresh message body (all seriesentry will null ), could someone help check it and provide some advice?
_refreshMsg.msgClass(MsgClasses.REFRESH); _refreshMsg.flags(RefreshMsgFlags.SOLICITED | RefreshMsgFlags.REFRESH_COMPLETE );
_refreshMsg.containerType(DataTypes.SERIES);
_refreshMsg.applyHasMsgKey();
_refreshMsg.msgKey().flags(key.flags()); _refreshMsg.msgKey().name(key.name()); _refreshMsg.msgKey().nameType(key.nameType()); _refreshMsg.msgKey().identifier(key.identifier()); _refreshMsg.msgKey().serviceId(key.serviceId()); _refreshMsg.msgKey().attribContainerType(key.attribContainerType()); _refreshMsg.msgKey().encodedAttrib(key.encodedAttrib());
ret = _refreshMsg.encodeInit(_encodeIter, 0);
/* create and initialize series structure */ Series series = CodecFactory.createSeries(); /* create a single SeriesEntry and reuse for each entry */ SeriesEntry seriesEntry = CodecFactory.createSeriesEntry();
/* encode the series */
but the encode xml like blow:
<REFRESH domainType="HISTORY" streamId="1026" containerType="SERIES" flags="0x68 (HAS_MSG_KEY|SOLICITED|REFRESH_COMPLETE)" groupId="0" State: Non-streaming/Ok/None - text: "" dataSize="400"> <key flags="0x37 (HAS_SERVICE_ID|HAS_NAME|HAS_NAME_TYPE|HAS_IDENTIFIER|HAS_ATTRIB)" serviceId="1" name="HL2_1" nameType="1" identifier="13" attribContainerType="ELEMENT_LIST"> <attrib> <elementList flags="0x08 (HAS_STANDARD_DATA)"> <elementEntry name="QueryString" dataType="UTF8_STRING" data="*:*"/> <elementEntry name="numresult" dataType="INT" data="1"/> <elementEntry name="StartDtTm" dataType="DATETIME" data="29 SEP 2016 00:44:30:000"/> <elementEntry name="User" dataType="ASCII_STRING" data="et"/> <elementEntry name="Position" dataType="ASCII_STRING" data="127.0.0.1"/> <elementEntry name="AppID" dataType="INT" data="170"/> </elementList> </attrib> </key> <dataBody> <series flags="0x08 ()" countHint="0" containerType="NO_DATA"> <seriesEntry> </seriesEntry> <seriesEntry> </seriesEntry> <seriesEntry> </seriesEntry> <seriesEntry> </seriesEntry> <seriesEntry> </seriesEntry> </series> </dataBody> </REFRESH>
if I remove the msgkey part, the refresh can encode the series entry correctly.