Perl Fax – Cancel Pending Fax

Download the Perl fax code samples.

To cancel a previously-submitted (outbound) Perl fax, use the CancelFax method.

CancelFax only effects Perl faxes waiting to be sent (with the status codes: -1 Preprocessing, -2 Ready, or -3 Pending Retry), and not faxes that are being actively transmitted at the time the method is called.

The following Perl fax script cancels a fax and checks if the cancellation succeeded:


#/**************** Settings begin **************/
my $username  = ''; # Enter your Interfax username here
my $password  = ''; # Enter your Interfax password here
my $transactionID = "";
my $NS = 'http://www.interfax.cc';
#/**************** Settings end ****************/


my $client = SOAP::Lite
    ->uri($NS)
    ->on_action( sub { join '/', $NS, $_[1] } ) 
    ->proxy('https://ws.interfax.net/dfs.asmx?WSDL');
    
my $result = $client
    ->call(SOAP::Data->name('CancelFax')->attr({xmlns => $NS}) =>
            SOAP::Data->name('Username')->value($username)->type(''),
            SOAP::Data->name('Password')->value($password)->type(''),
            SOAP::Data->name('TransactionID')->value($transactionID)->type('')
    );


if ( $result->fault ) {
    print $result->faultstring . "\n";
} else {
    if( $result->valueof('//CancelFaxResult') == 0 ) {
        print "Success" . "\n";
    } else {
        print "Error, return code=" . $result->valueof('//CancelFaxResult') . "\n";
    }
}