From: Frank Reiff Date: 2007-12-07T22:28:28+09:00 Subject: receiving an XML POST via CGI Hi, I'm a competent enough Objective-C and Java programmer, but I'm still having the occasional problem getting my head around the "Ruby way". The class that gives me most headaches is CGI.. I've got a script running on Apache mod_fcgi that receives an HTML POST containing an XML message from another server (a light weight web service). I parse this message and send emails, update databases and logs based on its content. My problem is that it works 99% of the time, but sometimes the XML gets split and reassembled incorrectly, e.g. ..lots of stuff.. occasionally arrives as: ..lots of stuff.. Obviously at that stage REXML is packing in as the XML string is incorrectly formatted. Now something tells me that the problem might well be in the way I use the CGI class to get to the POST data: # gets a cgi object from the FCGI dispatcher FCGI.each_cgi { |cgi| # prints the parameters to the standard error for debugging $stderr.puts "cgi.params: #{cgi.params}" # parse the parameters doc = Document.new cgi.params.to_s I'm wondering whether there is any "ruby magic" to the cgi.params call. I never quite understand what's actually in there, is it a simple string, a hash of strings or an array of hashes or a hash of hashes or sometimes one and sometimes another.. I'm sure it's frightfully convenient, but I can't get my head around it.. The documentation simply confuses me even further.. it just looks like my string re-assembly problem might stem from there.. Any help would be much appreciated. Best regards, Frank -- Posted via http://www.ruby-forum.com/.