Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

TeeJay (2309)

TeeJay
  (email not shown publicly)
http://www.aarontrevena.co.uk/

Working in Truro
Graduate with BSc (Hons) in Computer Systems and Networks
pm : london.pm, bath.pm, devoncornwall.pm
lug : Devon & Cornwall LUG
CPAN : TEEJAY [cpan.org]
irc : TeeJay
skype : hashbangperl
livejournal : hashbangperl [livejournal.com]
flickr :hashbangperl [flickr.com]

Journal of TeeJay (2309)

Thursday February 03, 2005
04:18 AM

mod_perl failing to cope with XML MIME types

[ #22990 ]

I was banging my head against a problem with mod_perl this afternoon. I am writing a very simple SOAP service (in fact its REST really but .Net/Java programmers seem to have a problem writing software that isn't generated mostly by WSDL and clicking on buttons, so SOAP it is)

After a while I managed to get a hint from mod_perl as to why it was eating the postdata that my SOAP::Lite client had sent :
[libapreq] unknown content-type: 'text/xml; charset=utf-8'. It didn't like 'text/xml' either.

I know the mod_perl and apache maintainers would love us all to move to Apache 2 and mod_perl 1.99999999 or whatever it is, but not bothering to update mod_perl to handle basic web service content types is really lame.

Anyway, there is a solution. 'use CGI;', get your parameters with '$cgi->Vars' and bobs your uncle. If Apache is so lame at handling mime-types that CGI.pm can handle then why not patch Apache::* based on the code in CGI. After all, one the great things about apache/mod_perl is that you have the power in perl to pull stunts in apache modules without having to recompile your apache or libraries (even without having to restart apache if you use the appropriate module and setting).

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • This is a libapreq problem, not a mod_perl problem per-se. If you don't convert $r into an Apache::Request object, you shouldn't see the warning.

    On a side note, calling the class "Apache::Request" is completely daft because it's completely different from the object returned by Apache->request, which is just a plain "Apache" object. Gah.

    -Dom

  • If you made a feature request on the libapreq mailing list instead of just insulting mod_perl (which is not even directly involved here) you would probably get better results.
    • Yes, that would be better.

      I was mostly making a note for myself or others who are likely to trip over the problem.

      I'll sub to the list and ask about why its happening (i.e. why some content-types aren't handled).

      --

      @JAPH = qw(Hacker Perl Another Just);
      print reverse @JAPH;
  • Having the same problem. I read the POST data like this:

    $r->read($data, $r->header_in("Content-Length"));

    ($r is an Apache::Request).

    Except that my error_log is full of this junk, everything works great. I tried various other content-type-s but with no luck.

    Have you manage to found a solution?