When I post the XML data as the message content to my rails website, I can see the exception info in the log file. The error message is "can''t typecast" the element name in my xml document. The first line in backtrace is: "c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/cgi_ext/cgi_methods.rb:111:in`typecast_xml_value''" Please give me some information on how to settle this problem. Thanks. -- Posted via http://www.ruby-forum.com/.
On 7/31/06, oliver <oliver.peng@skywave.com> wrote:> When I post the XML data as the message content to my rails website, I > can see the exception info in the log file. The error message is "can''t > typecast" the element name in my xml document. > > The first line in backtrace is: > "c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/cgi_ext/cgi_methods.rb:111:in`typecast_xml_value''" >Are you passing attributes with the elements? I''ve found that rails can''t handle attributes and croaks with just that message.
oliver wrote:> When I post the XML data as the message content to my rails website, I > can see the exception info in the log file. The error message is "can''t > typecast" the element name in my xml document. > > The first line in backtrace is: > "c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/cgi_ext/cgi_methods.rb:111:in`typecast_xml_value''" > > Please give me some information on how to settle this problem. Thanks.Sounds like something is wonky with your XML syntax. LIke maybe it can''t tell if it''s a number or a string or something. Try adding <foo type="integer">1</foo> style tags into your XML and see if that helps. -- Posted via http://www.ruby-forum.com/.
oliver wrote:> When I post the XML data as the message content to my rails website, I > can see the exception info in the log file. The error message is "can''t > typecast" the element name in my xml document. > > The first line in backtrace is: > "c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/cgi_ext/cgi_methods.rb:111:in`typecast_xml_value''" > > Please give me some information on how to settle this problem. Thanks.Thanks for attention. I have found the reason. In rails it defaults to using XmlSimple to parse the xml content. I just need to reset ActionController::Base.param_parsers[Mime::XML] to do nothing, then the error message disappear. -- Posted via http://www.ruby-forum.com/.