POST /service.asmx HTTP/1.1
Host: foo.com
Content-Type: text/xml; charset=utf-8
Content-Length: [length]
SOAPAction: "https://foo.com/IntegrateShipmentNotice"
[XML]
####
SOAP::Transport::new: ()
SOAP::Serializer::new: ()
SOAP::Deserializer::new: ()
SOAP::Parser::new: ()
SOAP::Lite::new: ()
SOAP::Transport::HTTP::Client::new: ()
SOAP::Data::new: ()
SOAP::Lite::call: ()
SOAP::Serializer::envelope: ()
SOAP::Serializer::envelope: IntegrateShipmentNotice SOAP::Data=HASH(0x89db70c)
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Transport::HTTP::Client::send_receive: HTTP::Request=HASH(0x89febf0)
SOAP::Transport::HTTP::Client::send_receive: POST https://foo.com/service.asmx HTTP/1.1
Accept: text/xml
Accept: multipart/*
Accept: application/soap
Content-Length: 2194
Content-Type: text/xml
SOAPAction: https://foo.com/IntegrateShipmentNotice
[live XML redacted out]
SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0x8d65ddc)
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 400 Bad Request
Cache-Control: private
Date: Tue, 28 Aug 2007 14:02:56 GMT
Server: Microsoft-IIS/6.0
Content-Length: 0
Client-Date: Tue, 28 Aug 2007 13:59:27 GMT
Client-Peer:
Client-Response-Num: 1
Client-SSL-Cert-Issuer: /C=GB/ST=Greater Manchester/L=Salford/O=Comodo CA Limited/CN=PositiveSSL CA
Client-SSL-Cert-Subject: /OU=Domain Control Validated/OU=PositiveSSL/CN=fulfillment.sciona.com
Client-SSL-Cipher: RC4-MD5
Client-SSL-Warning: Peer certificate not verified
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
400 Bad Request at ./procShipAck.SOAP.pl line 80
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Transport::HTTP::Client::DESTROY: ()
SOAP::Lite::DESTROY: ()
SOAP::Deserializer::DESTROY: ()
SOAP::Parser::DESTROY: ()
SOAP::Transport::DESTROY: ()
SOAP::Serializer::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
####
#!/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";
}
}