Imported from previous forum
Guys, need help on QuickFix.
We are a buyside firm and trading with a counter-party through FIX. Both are using QuickFix (.Net). We have mutually developed a few custom messages (user defined) e.g. Multi-leg orders in Fix4.2 (otherwise not supported in 4.2).
We have extented from QuickFix.Message Class (as all other classes in quickfix do). We are able to initialize and construct the custom message on outbound side and send to quick fix without any problem.
However on the inbound side, when we get the OnMessage event and try to cast Message into Custom Message Class, we are unable to cast it.
(We have taken care of dictionary etc)
Any thoughts?
e.g.
Buy Side:
FIX.NewOrderMultiLeg fixOrder = new FIX.NewOrderMultiLeg(); //custom message
Session.sendToTarget(fixOrder, sessionID); // works fine
Sell Side:
onMessage(QuickFix.Message message, QuickFix.SessionID session)
{
FIX.NewOrderMultiLeg _order = (FIX.NewOrderMultiLeg)message; // fails (unable to cast .net exception)
}
FIX.NewOrderMultiLeg is inheriting from QuickFix42.Message class of QuickFix.
Both buy side and sell side have the same implementation of FIX.NewOrderMultiLeg as well as QuickFix versions are same.
Where do you construct the incomming message? you probably have a regular QuickFix Message Object (with your custom message in it) but cannot cast it down to the type you want since it is actually the QuickFix.Message class - not your subtype.
Feel free to email me off line
Kind Regards
John
Guys, need help on QuickFix. We are a buyside firm and trading with a
counter-party through FIX. Both are using QuickFix (.Net). We have
mutually developed a few custom messages (user defined) e.g. Multi-leg
orders in Fix4.2 (otherwise not supported in 4.2). We have extented from
QuickFix.Message Class (as all other classes in quickfix do). We are
able to initialize and construct the custom message on outbound side and
send to quick fix without any problem.However on the inbound side, when we get the OnMessage event and try to
cast Message into Custom Message Class, we are unable to cast it. (We
have taken care of dictionary etc)Any thoughts?
e.g.
Buy Side: FIX.NewOrderMultiLeg fixOrder = new
FIX.NewOrderMultiLeg(); //custom message
Session.sendToTarget(fixOrder, sessionID); // works fineSell Side: onMessage(QuickFix.Message message, QuickFix.SessionID
session) { FIX.NewOrderMultiLeg _order = (FIX.NewOrderMultiLeg)message;
// fails (unable to cast .net exception) }FIX.NewOrderMultiLeg is inheriting from QuickFix42.Message class of
QuickFix. Both buy side and sell side have the same implementation of
FIX.NewOrderMultiLeg as well as QuickFix versions are same.