Here follows the client side and server side code that I use to
connect with SOAP to an Apache linux server, server has Perl5.8.8
running with latest SOAP::Lite package installed.
The client is a win2k machine with latest SOAP::Lite package and
Perl5.8.8 installed.
<client code>
#!perl
use SOAP::Lite +trace => 'all';
use SOAP::Lite::Packager;
use MIME::Entity;
my $ent = build MIME::Entity
Id => "test",
Type => "text/plain",
Path => "C:\\testfile.txt",
Encoding => "base64",
Filename => "testfile.xml",
Disposition => "attachment"
;
my $sendtest = SOAP::Lite
-> uri('
http://denbosch/blaat')
-> parts([$ent])
-> proxy('
http://denbosch/soap/')
-> blaater()
; # leaving -> parts([$ent]) out of the code allows it to work,
but it doesn't send the file then...
$errors = $sendtest
-> fault;
foreach my $key (keys %$errors){
print "$key --> $$errors{$key}\n";
}
print $sendtest
-> result;
</client code>
<server code>
package files::blaat;
use MIME::Entity;
use vars qw(@ISA);
@ISA = qw(Exporter SOAP::Server::Parameters);
sub blaater{
my $envelope = pop;
# read attachments
my $returns;
my $ent = build MIME::Entity
Id => "test",
Type => "text/plain",
Path => "/var/soap/testfile.txt",
Filename => "testfile.txt",
Disposition => "attachment"
;
foreach my $part (@{$envelope->parts}) {
my $handle = $part->stringify;
}
return SOAP::Data->name('convertedTemp',123),$ent;
}
sub new {
my $self = shift;
my $class = ref($self) || $self;
bless {_blaat => shift} => $class;
}
1;
__END__
</server code>
also tried it with PerlSendHeader On in the apache code.
<apache code @ /etc/apache2/sites-enabled/000-default >
Alias /soap/ "/var/soap/"
<Location /soap>
SetHandler perl-script
PerlHandler Apache::SOAP
PerlSetVar dispatch_to "/var/soap/modules"
PerlSetVar dispatch_with "
http://denbosch/blaat =>
files::blaat"
PerlSetVar options "compress_threshold => 10000"
PerlSendHeader Off
Options +ExecCGI
</Location>
</apache code>
On Fri Sep 05 05:53:26 2008, BenZegveld wrote:
Show quoted textxmlns:soap="
http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><blaa
Show quoted text> ter xmlns="
http://denbosch/blaat"
> xsi:nil="true" /></soap:Body></soap:Envelope>
> ------------=_1220606975-2140-0
> Content-Type: text/plain; name="testfile.xml"
> Content-Disposition: attachment; filename="testfile.xml"
> Content-Transfer-Encoding: base64
> Content-ID: test
> MIME-Version: 1.0
> X-Mailer: MIME-tools 5.427 (Entity 5.427)
>
> dGVzdCBiZXN0YW5kIG9tIHRlIHZlcnN0dXJlbi4=
>
> ------------=_1220606975-2140-0--
> '
>
> this is not correctly transformed into 2 Entities. 1 for the
envelope
Show quoted text> and 1 for the file. it is handled as 1 Entity (not 100% certain
about
Show quoted text> this but it looks this way), with the Content-Type set to
text/plain.
Show quoted text>
> The fix I mentioned earlier only helps SOAP:Lite to get past the
> checkpoint for deciding to handle it as a multipart or not.
>
> Currently checking some data more information follows.
>
> On Thu Sep 04 10:04:42 2008, BenZegveld wrote:
> > Apache's boundaries are not filtered with this check for envelope
> > delivery:
> > (Location: SOAP/Lite.pm lines 1959-1963 in version 0.710.08)
> > sub is_xml {
> > # Added check for envelope delivery. Fairly standard with MMDF
> and
> > sendmail
> > # Thanks to Chris Davies <Chris.Davies@ManheimEurope.com>
> > $_[1] =~ /^\s*</ || $_[1] !~ /^(?:[\w-]+:|From )/;
> > }
> > by making a minor change in the check like this:
> > __ _
> > $_[1] =~ /^\s*</ || $_[1] !~ /^(?:[\w-]+[=:]|From )/;
> > they are filtered and correctly seen as a multipart message
instead
Show quoted text> of
> > a xml message.
> >
> > The first line of the multipart message with apache that is
checked
Show quoted text> > contains the boundary which starts with "------------="
> >
> > ofcourse this change hasn't been fully checked with all the xml
> setups
> > and it is possible that you need to extract that bit into a check
> that
> > derives into ^-+=.
>