I use a QuickFix/n initiator. My broker rejects my logon messages, citing wrong order of fields (tags) in the message header. Instead of 34, 49, 52, 56, the order should be 49, 56, 34, 52.
QuickFix/n seems to automatically sort the various fields within the three regions (header, body, trailer) of messages by tag number upon sending the message to the session.
Is there a way to change the order of the fields in a message sent to an acceptor? Is there a way to prevent the sorting behaviour? (Adding groups to the message or changing the data dictionary don't work.)
Or if that is impossible with QuickFix/n, is there a FIX engine which allows changing the order of fields in messages?
This error is normally caused by trying to put a header field into the body of the message. The DataDictionary object provided either by yourself if you are manually adding it to the session or from the session itself (if you are using the config file to tell the session which data dictionary to use) has functions called isHeaderField(int tagNumber) and isTrailerField(int tagNumber) to help you decide if the field should be in the header or the trailer. Different data dictionary files for different counterparties may (I've only seen it once or twice) put header fields into the body part of the message, body fields into the header, or (most commonly) custom tags into the header. This means that it is generally a good idea to use the available functions to check whether a field should be added to the header, body, trailer or a repeating group within the body. Since this question is about logon messages I am guessing that you are adding fields to that message type so I may need to see the code doing that to help further.
By default quickFix reorders tags in a group by ascending order. If you want to retain the order you need to rebuild the quick fix jar as suggested here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With