gzip Perl/SOAPLite Sample 1

Following is a sample of un-annotated Perl/SOAPLite Code for gzip compression

 #!c:\Perl\bin\perl -w

 

use Compress::Zlib;

use SOAP::Lite +trace => 'debug';

 

$namespace = 'http://webservices.galileo.com';

$endpoint = 'https://americas.webservices.travelport.com/B2BGateway/service/XMLSelect';

$action = 'SubmitXml';

 

$hostaccessprofile = 'DynApolloCopy_XXX';

$username = 'XXXXXXXXXX';

$password = 'XXXXXXX';

my $soap = SOAP::Lite

  -> uri($namespace)                       

  -> on_action(sub{sprintf '%s/%s', @_ })

  -> outputxml("1")

  -> proxy($endpoint, options => {compress_threshold => 1});

 

sub SOAP::Transport::HTTP::Client::get_basic_credentials {

    return $username => $password;

  }

$request = '

<Request>

<LocalDateTimeCT_6_0 xmlns="">

<LocalDateTimeMods>

<ReqCity>ORD</ReqCity>

</LocalDateTimeMods>

</LocalDateTimeCT_6_0>

</Request>';

 

$filter = '

<Filter>

<_ xmlns="" />

</Filter>';

 

my $response = $soap

  ->call(SOAP::Data->name($action)->attr({xmlns => $namespace}),

SOAP::Data->name(Profile => $ hostaccessprofile)->type('string'),

SOAP::Data->name(Request => $request)->type('xml'),

SOAP::Data->name(Filter => $filter)->type('xml'));

 

print $response;