modperl-post_method_to_recieve_xml

This is part of The Pile, a partial archive of some open source mailing lists and newsgroups.



To: Maarten Stolte <datadevil@crash.nu>
From: Joshua Chamas <joshua@chamas.com>
Subject: Re: receiving XML by POST
Date: Mon, 26 Nov 2001 15:12:50 -0800

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.

===
To: Joshua Chamas <joshua@chamas.com>
From: Tom Servo <tomservo@cnw.com>
Subject: Re: receiving XML by POST
Date: Mon, 26 Nov 2001 15:15:37 -0800 (PST)

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.


===


the rest of The Pile (a partial mailing list archive)

doom@kzsu.stanford.edu