swayam4u has asked for the wisdom of the Perl Monks concerning the following question:

HI,

I am calling a remote web service from UNIX box through perl Soap lite.

I need to call that Webservice ~150 times with different parameters and I want that after each call to the web service the connection should be dropped and all the TCP/HTTP connection to the web service should be destroyed .How to Do this ?

My code

&ExecuteCognosReport($rPATH,$rParamater,$rFileFormat,$rFileName,$rPToSave)<\p>

sub ExecuteCognosReport

{

my $Report=shift;

chomp $Report;

my $Parameters=shift;

chomp $Parameters;

my $OutputFormat=shift;

chomp $OutputFormat;

my $FileName=shift;

my $ptoSavetheReport=shift;

chomp $ptoSavetheReport;

my $response;

my $start_run = time();

print "\nStart Time is $start_run\n";<\p>

my $soap = SOAP::Lite

-> uri($uri)

-> on_action(sub { "$uri"."IDataService/ExecuteCognosReportSimpleTypes"})

-> proxy($url,timeout => 2000,)

->autotype(0)->readable(1);

eval {

$response = $soap->ExecuteCognosReportRequestSimpleTypes(

SOAP::Data->new(name => 'Report', value => "$Report"),

SOAP::Data->new(name => 'Parameters', value => "$Parameters"),

SOAP::Data->new(name => 'OutputFormat', value => "$OutputFormat"),

SOAP::Data->new(name => 'FileName', value => "$FileName"),);

# Print the Result

if ($response->fault)

{

warn $response->faultstring;

}

else

{

print $response->result;

print "\n";

}

};

}

Replies are listed 'Best First'.
Re: Perl Soap Lite Destoy the connection
by Anonymous Monk on Oct 22, 2011 at 12:31 UTC
    If you don't use keep_alive option, connection will not be kept alive