Problem in posting xml content

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.

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 1 style tags into your XML and see
if that helps.

On 7/31/06, oliver [email protected] 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.

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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs