This was quite a while ago and I don't remember the details.
But here is a basic script that you can start with...
Warning: this code is adapted and untested.
use strict;
use warnings;
use SOAP::Lite +trace => "all";
use MIME::Base64 qw(encode_base64);
$ENV{HTTPS_DEBUG} = 1;
$ENV{HTTPS_VERSION} = '3';
$ENV{HTTPS_CERT_FILE} = 'C:/path/to/certificate.pem';
my $input_filename = "test.pdf";
my $input_filepath = "C:/path/$input_filename";
my $namespace = "http://host/path";
my $method_name = "MethodName";
my $soap_action = "http://host/path/soap_action";
my $end_point = "https://host/path/endpoint";
my $encoded_file = '';
my $buffer = '';
my $file_content = '';
if (open(my $ifh, $input_filepath)) {
binmode($ifh);
$file_content = do { local $/; <$ifh> };
close($ifh);
} else {
die "[Error] Could not open file - $input_filepath - $!";
}
$encoded_file = encode_base64($file_content);
my $file_size = -s $input_filepath;
my $soap = SOAP::Lite
-> uri($soap_action)
-> on_action( sub { join '/', $namespace, $_
+[1] } )
-> proxy($end_point);
my $method = SOAP::Data->name($method_name)
->attr( { xmlns => $namespace });
my @params = (
SOAP::Data->name("request" => \SO
+AP::Data->value(
SOAP::Data->name("FileName" => $in
+put_filename)->type("string"),
SOAP::Data->name("Filesize" => $fi
+le_size)->type("int"),
SOAP::Data->name("Data" => $en
+coded_file)->type("base64Binary")
)),
);
print $soap->call($method => @params)->result;
|