Jano Svitok
3/28/2008 7:31:00 AM
On Fri, Mar 28, 2008 at 6:36 AM, Rajat Garg <rajat79@gmail.com> wrote:
> Hi Guys,
>
> I have a Ruby API that is getting called by a Flex app using POST. The
> problem is as long as data is in the format of -
>
> user[name]=alsk
> user[email]=klsd
> user[pass]=03493
>
> it is fine. But, when it has say two root elements like,
>
> user[name]=alsk
> user[email]=klsd
> user[pass]=03493
> fc_id =232
>
> It will start crapping out with error messages like -
> Session ID: e3fe6e12eb9f685d82d87f413590efa9
> Parameters: {"format"=>#<Mime::Type:0xb797b21c @synonyms=["text/xml",
> "application/x-xml"], @symbol=:xml, @string="application/xml">,
> "exception"=>"#<REXML::ParseException: malformed XML: missing tag
> start\nLine: \nPosition: \nLast 80 unconsumed characters:\n<user[email]>
> nuwan@nuwan.com</user[email]><user[first_name]>nuwan</user[first_nam>\n/usr/local/lib/ruby/1.8/rexml/parsers/baseparser.rb:346:in
> `pull'\n/usr/local/lib/ruby/1.8/rexml/parsers/treeparser.rb:21:in
> `parse'\n/usr/local/lib/ruby/1.8/rexml/document.rb:190:in
> `build'\n/usr/local/lib/ruby/1.8/rexml/document.rb:45:in
> `initialize'\n/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/vendor/xml_simple.rb:952:in
>
>
>
> What is the problem? Can I only pass 1 record with a set of values or can I
> pass two records. Same thing works for GET.
The error message is about malformed XML. Maybe you could look at the
xml source to see what's wrong.
For example - there's </user[first_nam> tag that seems wrong.
Other than that, it would help if you specify what framework are you
using (rails, active webservice, etc.)
- this doesn't look like a plain POST request since XML somehow got
into processing...