Loading ...
Sorry, an error occurred while loading the content.

3948MIME::Lite sends XML data, ::HTTP::Apache expects form data?

Expand Messages
  • flarneater
    Sep 27, 2004
    • 0 Attachment
      I'm trying to configure a SOAP server using MIME::Lite. I'm using
      this code on the client side:

      my $sl = SOAP::Lite
      -> proxy( 'http://localhost:7070/soaptest' )
      -> uri( '/soaptest' );

      $sl->Runner( SOAP::Data->name( blotto => 'foobarius' ) );
      print $sl->result, "\n";

      Which generates this request:

      POST http://localhost:7070/soaptest
      Accept: text/xml
      Accept: multipart/*
      Content-Length: 499
      Content-Type: text/xml; charset=utf-8
      SOAPAction: "/soaptest#Runner"

      <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope

      which in turns generates this result:

      HTTP/1.1 400 Bad Request
      Connection: close
      Date: Mon, 27 Sep 2004 16:36:46 GMT
      Server: Apache/1.3.31 (Unix) mod_perl/1.29
      Content-Type: text/html; charset=iso-8859-1
      Client-Date: Mon, 27 Sep 2004 16:36:46 GMT
      Client-Response-Num: 1
      Client-Transfer-Encoding: chunked
      Title: 400 Bad Request
      X-Cache: MISS from localhost

      <TITLE>400 Bad Request</TITLE>
      <H1>Bad Request</H1>
      Your browser sent a request that this server could not understand.<P>
      [libapreq] unknown content-type: `text/xml; charset=utf-8'<P>

      SOAP::Transport::HTTP::Apache is throwing an error when it tries to
      fetch the 'class' paramter from the args passed in the request:

      my %args = $r->args();
      unless (exists $args{class}) {
      return BAD_REQUEST;

      I know the error is occurring here, as I've placed debugging messages
      in the module.

      The server code is this:

      use SOAP::Transport::HTTP::Apache;

      sub handler {
      my $safe_classes = {
      Runner => undef,
      print STDERR "-------SOAP SERVER START -----------\n";
      my $rc = SOAP::Transport::HTTP::Apache->handler($safe_classes);
      print STDERR "-------SOAP SERVER END -----------\n";
      return $rc;

      The two messages are written to the log, but the 'Runner' class is
      never invoked.

      What appears to be happening is that SOAP::Lite is POSTing a XML
      document with a content type of text/xml, whereas ::HTTP::Apache is
      expected form-encoded data (via calling $r->args).

      I've also tried specifying

      $SOAP::Constants::DO_NOT_USE_CHARSET = 1;
      $SOAP::Constants::DO_NOT_CHECK_CONTENT_TYPE = 1;

      but it did not help.

      I'm following the example in the SOAP::Lite docs, so one would assume
      that this worked at one point. What am I doing wrong?

      Many thanks!