ColdFusion Fax – Cancel Pending Fax

Cancelling a previously-submitted outbound fax with ColdFusion can be done using the CancelFax method.

The following ColdFusion fax snippet cancels a fax and checks if the cancellation was successful.

Using CancelFax with ColdFusion only effects 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.


<cfoutput>

<!--- Username and password for the Interfax account. --->
<cfset interfaxUsername = "">
<cfset interfaxPassword = "">
<cfset transactionID     = "">


<!--- Create and call the web service --->
<cfset faxWebService = CreateObject("webservice", "https://ws.interfax.net/dfs.asmx?WSDL")>

<cfset CancelFaxResult = faxWebService.CancelFax(interfaxUsername, interfaxPassword, transactionID)>


<!--- Check to see if cancellation of transaction is successful. --->
<cfif CancelFaxResult eq 0>
    Cancellation of transaction is successful.
<cfelse>
    Error cancelling fax.
    Return code: #CancelFaxResult#.<br>
    Error message:  #CancelFaxResult#
</cfif>
</cfoutput>