quickfix InvalidMessage Header fields out of order

quickfix InvalidMessage Header fields out of order

This is very common message when you are working first time with FIX protocol and this happens if the way you have created the message not matching with FIX specification and you get exception below:

Exception in thread “main” quickfix.InvalidMessage: Header fields out of order

Solution: In my case it was happening because I had created FIX message using below Message class from QuickFix API as sample method below:

  • To fix this issue I had to change from Message class to NewOrderSingle Class to create FIX message as below:

Also please validate message using QuickFix parser as below:

quickfix.Message message = MessageUtils.parse(quickfix.Session.lookupSession(sessions.get(0)), messageFixString);

Example below:

I have written complete tutorial on FIX engine please refer tutorial here and for more information please visit QuickFix here

Leave a Reply

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