Re: receiving XML by POST

2001-11-26 Thread Joshua Chamas

Maarten Stolte wrote:
 
 Hello,
 
 i'm trying to figure out how to receive an xml message/file/stream(?)
 using POST, and how to be able to then send that to somewhere else
 (DBI).
 We're using MASON, don't know if that is information needed in this, but
 i saw something about MASON picking up all posts.

I believe the usual way to access POST data, $r-content, is only
for form data.  To get XML data, try this:

  my $buf = '';
  $r-read($buf, $ENV{CONTENT_LENGTH});

This is a general mod_perl API issue, and not necessarily specific
to Mason, though Mason may have some other API specific to this.
This may in fact collide with Mason form processing if there is
any, since a mod_perl application will hang if it tries to 
read the POST data twice.

-- Josh
_
Joshua Chamas   Chamas Enterprises Inc.
NodeWorks Founder   Huntington Beach, CA  USA 
http://www.nodeworks.com1-714-625-4051



Re: receiving XML by POST

2001-11-26 Thread Tom Servo

On Mon, 26 Nov 2001, Joshua Chamas wrote:

 Maarten Stolte wrote:
  
  Hello,
  
  i'm trying to figure out how to receive an xml message/file/stream(?)
  using POST, and how to be able to then send that to somewhere else
  (DBI).
  We're using MASON, don't know if that is information needed in this, but
  i saw something about MASON picking up all posts.
 
 I believe the usual way to access POST data, $r-content, is only
 for form data.  To get XML data, try this:
 
   my $buf = '';
   $r-read($buf, $ENV{CONTENT_LENGTH});
 
 This is a general mod_perl API issue, and not necessarily specific
 to Mason, though Mason may have some other API specific to this.
 This may in fact collide with Mason form processing if there is
 any, since a mod_perl application will hang if it tries to 
 read the POST data twice.
 

Mason generally does an automatic read of POST data, specify what form
fields you want, and it'll stuff the values into variables named the same
as the name fields in the POST data.   You should just be able to have the
XML be the value for some name/value pair, then do all your XML
parsing/DBI work on that value.