You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Rob Mueller <ro...@fastmail.fm> on 2003/03/18 07:55:50 UTC

SOAP::Lite and libapreq...

I'm having a problem using a SOAP::Lite mod_perl handler, and I can't seem
to see what I'm missing.

Basically I've setup a section as such:

<Location /soap>
  SetHandler perl-script
  PerlHandler SOAP::Handler
</Location>

And the module SOAP::Handler as such:

use strict;
use SOAP::Transport::HTTP;

my $server = SOAP::Transport::HTTP::Apache
  -> dispatch_to('SOAP::Services');

sub handler { $server->handler(@_); }

And then I've got all my calls in SOAP::Services. Now, it's actually working
properly, but every request I get, I see this in the error log.

[Tue Mar 18 17:24:10 2003] [error] [client 127.0.0.1] [libapreq] unknown
content-type: `text/xml; charset=utf-8'

Having a look in libapreq I find:

    if (r->method_number == M_POST) {
        const char *ct = ap_table_get(r->headers_in, "Content-type");
        if (ct && strncaseEQ(ct, DEFAULT_ENCTYPE, DEFAULT_ENCTYPE_LENGTH)) {
            result = ApacheRequest_parse_urlencoded(req);
        }
        else if (ct && strncaseEQ(ct, MULTIPART_ENCTYPE,
MULTIPART_ENCTYPE_LENGTH)) {
           result = ApacheRequest_parse_multipart(req);
        }
        else {
            ap_log_rerror(REQ_ERROR,
                          "[libapreq] unknown content-type: `%s'", ct);
            result = HTTP_INTERNAL_SERVER_ERROR;
        }
    }
    else {

and

c/apache_request.h:#define DEFAULT_ENCTYPE
"application/x-www-form-urlencoded"
c/apache_request.h:#define DEFAULT_ENCTYPE_LENGTH 33

c/apache_request.h:#define MULTIPART_ENCTYPE "multipart/form-data"
c/apache_request.h:#define MULTIPART_ENCTYPE_LENGTH 19

Creating a SOAP::Lite client and setting +trace => 'all', I see:

Accept: text/xml
Accept: multipart/*
Content-Length: 530
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://localhost/MEServices#CreateSession"

<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV=http://schemas.xmlsoap.org/soap/envelope/
xmlns:xsd="http://www.w3.org/1999/XMLSchema"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">

So SOAP::Lite is setting the Content-Type to "text/xml; charset=utf-8", but
libapreq only accepts "application/x-www-form-urlencoded" or
"multipart/form-data" or POST requests.

Strangely though, the request does actually work, and the SOAP method does
get called correctly. I haven't looked further into the code to see why this
is.

Anyway, I can't actually see how a mod_perl SOAP handler can work without
getting this error message very time in the log, and I can't believe that
no-one else has come across this before, and that I must be missing
something very obvious...

Can anyone help?

Rob