#!/usr/bin/perl -w use strict; use SOAP::Lite qw( debug ); $SOAP::Constants::DO_NOT_USE_CHARSET = 1; my $XMLURI = 'https://foo.com/'; my $PROXY = 'https://foo.com/service.asmx'; my @files; # If files have been passed on the command line, use them. if ( @ARGV ) { foreach my $this_file ( @ARGV ) { if ( -e $this_file && $this_file =~ m/\.xml \Z/smxi ) { push @files, $this_file; } } } exit if @files < 1; foreach my $ackfile ( @files ) { # There's gotta be a way to simply pass $ackfile straight to # SOAP::Lite instead of building a string, but I haven't # figured it out yet... open my $fh, "<", $ackfile or die "Can't open $ackfile: $!"; my @xml = <$fh>; close $fh; my $xml = join "", @xml; if ( not $debug ) { my $soap = SOAP::Lite -> uri( $XMLURI ) -> proxy( $PROXY ) -> default_ns( $XMLURI ) -> autotype( 0 ) -> on_action( sub { 'https://foo.com/IntegrateShipmentNotice' } ) ; print $soap->IntegrateShipmentNotice( SOAP::Data->name( shipmentNotice => $xml ) ) -> result . "\n\n" ; } else { print $xml . "\n"; } }