Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: Any perl module support MTOM in SOAP::Lite?

by tokpela (Chaplain)
on Aug 14, 2009 at 22:21 UTC ( #788768=note: print w/replies, xml ) Need Help??

in reply to Any perl module support MTOM in SOAP::Lite?

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;

Replies are listed 'Best First'.
Re^2: Any perl module support MTOM in SOAP::Lite?
by Anonymous Monk on Aug 15, 2009 at 01:13 UTC

      Thanks for the link, Anonymous!

      Yeah, as I said it's been quite a few years and I remember trying to get DIME and MTOM support working in SOAP::Lite and my head spinning.

      I forgot about the MIME conversion and sending as an attachment which we never ended up doing.

      For anyone coming to this post in the future, here is a good example showing the difference between my original post example and an actual MTOM message.

        Thank for quick response. I believe you meant: - MTOM is not not supported in SOAP::Lite right now? - XML::Compile supports MTOM, but it is not part of SOAP::Lite? Is that right? Also from the example you pointed out, is there any PERL modules to let me write the SOAP codes to support MTOM? (If yes, any sample codes around?) Thanks.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://788768]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2018-05-25 09:27 GMT
Find Nodes?
    Voting Booth?