Hi all,
I have the following server configuration:
*. Apache/2.2.11 (Ubuntu)
*. mod_perl/2.0.4
*. Perl/v5.10.0
*. SOAP Lite 0.710.08
I am trying to send a MIME::Entity attachment from a client perl script and from .NET program (using PocketSOAP) to the SOAP Lite server.
Perl client:
(...)
my $ent = MIME::Entity->build(
Type => "application/octet-stream",
Id => "<$cid>",
Encoding => "base64",
Path => $filepath,
Filename => $filename,
Disposition => "attachment"
);
(...)
my $Service = SOAP::Lite->new(
packer => SOAP::Packager::MIME->new,
uri => "urn:myapp:storageservice",
proxy => "http://localhost:8880/soap"
);
(...)
$test = $Service->uploadFile(SOAP::Data->name("filePath" => $filepath),
SOAP::Data->name("file")->attr({href => "cid:$cid"}));
Apache conf:
<Location /soap>
SetHandler perl-script
PerlHandler MyAPP::Handler
</Location>
Apache handler:
package MyAPP::Handler;
(...)
my $uri = 'urn:myapp'
my $server = SOAP::Transport::HTTP::Apache
->packager(SOAP::Packager::MIME->new)
->dispatch_with({"$uri:storageservice" => 'MyAPP::Storage',
(...) });
sub handler { $server->handler(@_) }
(...)
Class
package MyAPP::Storage;
(..)
@ISA = qw(Exporter SOAP::Server::Parameters)
(...)
sub uploadFile {
my $self = shift;
my $som = pop;
my $sample = $som->valueof('//file');
my $filepath = $som->valueof('//filepath');
(...)
my $uploadFileResult= SOAP::Data->name('uploadFileResult')
->type('string')->value($status);
return $uploadSampleResult;
}
From SOAP Lite perl client the call fails with the following error message:
(...) <soap:Body><soap:Fault><faultcode>soap:Client</faultcode><faultstring>Application failed during request deserialization: syntax error at line 1, column 0, byte 0 at /usr/lib/perl5/XML/Parser.pm line 187
</faultstring></soap:Fault></soap:Body>(...)
From .NET PocketSoap client the call fails with the following error message:
{"Client : Application failed during request deserialization: \nnot well-formed (invalid token) at line 2, column 7, byte 9 at /usr/lib/perl5/XML/Parser.pm line 187\n"}
-
In the CGI mode all works, same for calls without attachments in both (CGI and mod_perl).
Has anyone successfully sent a MIME attachment from a perl client to an Apache/SOAP Server?
Regards,
Adverick B.