use SOAP::Lite; my $configfile="Config.txt"; my $host; my $cusername; my $cpassword; my $cexpr1; my $offset = 0; while ($offset < $loop) { my $username = SOAP::Data->name('username' => $cusername ); my $password = SOAP::Data->name('password' => $cpassword ); my $service = SOAP::Lite -> uri( 'https://' . $host . '/reports?wsdl' ) -> proxy( 'https://' . $host ); $timestamp = localtime(time); #Retrieve the records my $expr = SOAP::Data->name('relevanceExpr' => $cexpr1 ); my $result = $service -> GetRelevanceResult( $expr, $username, $password ); if( $result->fault ) { print " [".$timestamp. "] ---- faultcode: " . $result->faultcode . "\n"; print " [".$timestamp. "] ---- faultstring: " . $result->faultstring . "\n"; } else { # Insert the data in to Temp table from API foreach my $answer ( $result->valueof( "//GetRelavanceResultResponse/a" ) ) { Insert in to the table. } } }