|
From: Toli K. <to...@ma...> - 2007-04-12 20:20:54
|
Hey All, Have a question for people using Text or EncodedText fields. I need to include one FIX message inside another (for example, i want to include the "offending" message into the reject message to show where the error is, such as missing field). I notice that if i include a FIX message inside another, it doesn't "roundtrip" well - we can do this, for example buy = new NewOrderSingle(.....) reject = new ExecutionReport(rejectReason, bla bla bla) reject.setField(new EncodedText(buy.toString()) reject.setField(new EncodedTextLen(buy.toString().length) reject.setField(new MessageEncoding(MessageEncoding.UTF_8) dataDictionary.validate(reject) roundTripped = new Message(reject.toString()) both the buy and the reject messsages validate with the given DataDictionary. However, when i try to create a "round-tripped" message directly from the text of the message containing another one, the Message parser fails (which may be a bug) I have the following questions: 1. Is this behavior even "legal"? Does FIX support embedding one message inside another? should it be allowed? 2. If that's the case, shouldn't EncodedText field take in bytes instead of a string, since you don't know which encoding is being used? 3. Should Message be able to parse such an "embedded" message back in? If the answer to all of this is true, then i'll file a bug about the Message.extractField() code. The reason it fails is that you end up with 2 SOH fields right after another in the message, and the parser can't parse it correctly (the first one form the end of the embedded message, and the 2nd SOH from the end of the EncodedText field). Here's the example of the last few fields of the embedded message followed by a trailer of the 'parent' message: ....60=20070404-15:15:51\00110=021\001\00160=20070404-23:16:21\001102=1\001434=1\00110=002\001"; note how you end up having ....\001\00160=...., which currently breaks the Java message parser (and i think the C++ QF parser as well) -- Toli Kuznets http://www.marketcetera.com: Open-Source Trading Platform download.run.trade. |