Thread: [Quickfix-developers] Issues trying to parse an outgoing logon message in ruby-based implementation
Brought to you by:
orenmnero
From: Al <bro...@gm...> - 2010-01-13 17:12:48
|
Hi. I'm having issues with a ruby implementation of an Initiator. I'm required to attach the password in tag 554 to be embedded into the FIX login message for 35=A. Using "password" in the cfg file does not work. (It’s in the FIx4.4 spec but not in the Fix4.2 spec, which is what I’m supposed to use.) So, I added some code in my toAdmin method to embed the password into the message. For some reason, I get an “undefined method” error right where I need to parse the message. It seems that whatever is getting passed through the method toAdmin into the message parameter isn’t actually the type of object I’m expecting. But my little debug line suggests that it is. (I tried to use Marshal to take a better peak into message, but got a "no marshal_dump is defined for class Quickfix::SessionID" error.) def toAdmin(sessionID, message) puts "toAdmin: #{message.to_s}\n" # debug: Displays “toAdmin: FIX.4.2:GBR->LIME” beginString = Quickfix::BeginString.new msgType = Quickfix::MsgType.new message.getHeader().getField( beginString ) # Error: undefined method `getHeader' message.getHeader().getField( msgType ) if msgType.getValue() == "A" add_logon_field(message); end rescue Exception => e print "Error: #{$!}\n" print e.backtrace end Output: <20100113-17:03:21, FIX.4.2:GBR->LIME, event> (Created session) <20100113-17:03:21, FIX.4.2:GBR->LIME, event> (Connecting to xx.xxx.xxx.xxx on port 9650) toAdmin: FIX.4.2:GBR->LIME Error: undefined method `getHeader' for FIX.4.2:GBR->LIME:Quickfix::SessionID lime.rb:31:in `toAdmin'../lib/ruby/quickfix_ruby.rb:6:in `block'../lib/ruby/quickfix_ruby.rb:6:in `start'../lib/ruby/quickfix_ruby.rb:6:in `initialize'../lib/ruby/quickfix_ruby.rb:6:in `new'../lib/ruby/quickfix_ruby.rb:6:in `start'lime.rb:116<20100113-17:03:22, FIX.4.2:GBR->LIME, outgoing> (8=FIX.4.29=6635=A34=4949=GBR52=20100113-17:03:22.00256=LIME98=0108=3010=253) <20100113-17:03:22, FIX.4.2:GBR->LIME, event> (Initiated logon request) <20100113-17:03:22, FIX.4.2:GBR->LIME, event> (Socket Error: Connection reset by peer.) <20100113-17:03:22, FIX.4.2:GBR->LIME, event> (Disconnecting) I appreciate any help/suggestions. Best, -Al |
From: Al <bro...@gm...> - 2010-01-13 19:20:47
|
To follow up, I'm wondering if the make warnings are related to this issue I'm facing. g++ -I. -I. -I/usr/lib64/ruby/1.8/x86_64-linux -I. -I../../include -fPIC -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -g -fno-strict-aliasing -fPIC -g -c QuickfixRuby.cpp In file included from QuickfixRuby.cpp:3588: QuickfixRuby.h:14: warning: declaration ‘class Swig::Director’ does not declare anything QuickfixRuby.cpp: In function ‘VALUE _wrap_new_FieldMap(int, VALUE*, VALUE)’: QuickfixRuby.cpp:12186: warning: ‘argv[0]’ may be used uninitialized in this function QuickfixRuby.cpp: In function ‘VALUE _wrap_new_ResetSeqNumFlag(int, VALUE*, VALUE)’: QuickfixRuby.cpp:30796: warning: ‘argv[0]’ may be used uninitialized in this function QuickfixRuby.cpp: In function ‘VALUE _wrap_new_IOINaturalFlag(int, VALUE*, VALUE)’: and the warnings continue on for over 1800 lines at the fail: label of each SWIG wrapper in QuickfixRuby.cpp. Thanks in advance to anyone who can help, -Al On Wed, Jan 13, 2010 at 11:12 AM, Al <bro...@gm...> wrote: > Hi. > > I'm having issues with a ruby implementation of an Initiator. I'm > required to attach the password in tag 554 to be embedded into the FIX > login message for 35=A. Using "password" in the cfg file does not > work. (It’s in the FIx4.4 spec but not in the Fix4.2 spec, which is > what I’m supposed to use.) > > So, I added some code in my toAdmin method to embed the password into > the message. For some reason, I get an “undefined method” error right > where I need to parse the message. It seems that whatever is getting > passed through the method toAdmin into the message parameter isn’t > actually the type of object I’m expecting. But my little debug line > suggests that it is. (I tried to use Marshal to take a better peak > into message, but got a "no marshal_dump is defined for class > Quickfix::SessionID" error.) > > def toAdmin(sessionID, message) > puts "toAdmin: #{message.to_s}\n" # debug: Displays “toAdmin: > FIX.4.2:GBR->LIME” > > beginString = Quickfix::BeginString.new > msgType = Quickfix::MsgType.new > message.getHeader().getField( beginString ) # Error: undefined > method `getHeader' > message.getHeader().getField( msgType ) > > if msgType.getValue() == "A" > add_logon_field(message); > end > > rescue Exception => e > print "Error: #{$!}\n" > print e.backtrace > end > > > Output: > > <20100113-17:03:21, FIX.4.2:GBR->LIME, event> > (Created session) > <20100113-17:03:21, FIX.4.2:GBR->LIME, event> > (Connecting to xx.xxx.xxx.xxx on port 9650) > toAdmin: FIX.4.2:GBR->LIME > Error: undefined method `getHeader' for FIX.4.2:GBR->LIME:Quickfix::SessionID > lime.rb:31:in `toAdmin'../lib/ruby/quickfix_ruby.rb:6:in > `block'../lib/ruby/quickfix_ruby.rb:6:in > `start'../lib/ruby/quickfix_ruby.rb:6:in > `initialize'../lib/ruby/quickfix_ruby.rb:6:in > `new'../lib/ruby/quickfix_ruby.rb:6:in > `start'lime.rb:116<20100113-17:03:22, FIX.4.2:GBR->LIME, outgoing> > (8=FIX.4.29=6635=A34=4949=GBR52=20100113-17:03:22.00256=LIME98=0108=3010=253) > <20100113-17:03:22, FIX.4.2:GBR->LIME, event> > (Initiated logon request) > <20100113-17:03:22, FIX.4.2:GBR->LIME, event> > (Socket Error: Connection reset by peer.) > <20100113-17:03:22, FIX.4.2:GBR->LIME, event> > (Disconnecting) > > > > I appreciate any help/suggestions. > > > Best, > > > -Al > |