View the status of an ASP Fax in XML structure

25 Nov 2016 This code sample is deprecated and in process of being removed. Check out our new code libraries and usage documentation on InterFAX @ Github.

How to view the status of an ASP fax, in XML structure.

Download the ASP file


<%
'
'Display fax transaction(s) status using soap object and FaxStatusXML method
'
Option Explicit

Dim objSoap

Set objSoap = Server.CreateObject("MSSOAP.SOAPClient30")

objSoap.ClientProperty("ServerHTTPRequest") = True

'
'Initializes the SoapClient object with the dfs.wsdl file
'
objSoap.mssoapinit(Server.MapPath("dfs.wsdl"))


If GetDataFromHost  0 Then
Response.Write "ERROR Occured"
End If

Set objSoap = Nothing

Function GetDataFromHost
Dim i
Dim objFax
Dim ListSize
Dim TotalCount
Dim ReturnCode
Dim strXML
Dim objXMLDoc
Dim objXMLRoot
Dim objXMLNodes
Dim objXMLNode

'
' Ask the host
'
strXML = objSoap.FaxStatusXML("username", "password", 999999999, 100, TotalCount, ListSize, ReturnCode)
'
' Get the data
'
If ReturnCode  0 Then
GetDataFromHost = ReturnCode
Exit Function
End If
'
' Parse the XML and add items to the collection
'
Set objXMLDoc = Server.CreateObject("Msxml2.DOMDocument.3.0")
If Not objXMLDoc.loadXML(strXML) Then
GetDataFromHost = -1
Exit Function
End If

Set objXMLRoot = objXMLDoc.documentElement

If objXMLRoot.nodeName  "Faxlist" Then
GetDataFromHost = -1
Exit Function
End If

Set objXMLNodes = objXMLRoot.selectNodes("Faxitem")

For Each objXMLNode In objXMLNodes
DisplayItem objXMLNode
Next

GetDataFromHost = 0

End Function

Sub DisplayItem(objNode)
Response.Write "Fax Transaction:"
Response.Write "===================="
Response.Write "TransactionID = " & GetXMLLongValue(objNode, "TransactionID") & ""
Response.Write "FaxNumber = " & GetXMLStringValue(objNode, "DestinationFax") & ""
Response.Write "Subject = " & GetXMLStringValue(objNode, "Subject") & ""
Response.Write "TimeSubmitted = " & GetXMLDateTimeValue(objNode, "SubmitTime") & ""
Response.Write "TimeCompleted = " & GetXMLDateTimeValue(objNode, "CompletionTime") & ""
Response.Write "TimePostponed = " & GetXMLDateTimeValue(objNode, "PostponeTime") & ""
Response.Write "PagesSubmitted = " & GetXMLLongValue(objNode, "PagesSubmitted") & ""
Response.Write "PagesSent = " & GetXMLLongValue(objNode, "PagesSent") & ""
Response.Write "Duration = " & GetXMLLongValue(objNode, "Duration") & ""
Response.Write "Status = " & GetXMLLongValue(objNode, "Status") & ""
Response.Write "RemoteCSID = " & GetXMLStringValue(objNode, "RemoteCSID") & ""
Response.Write "Contact = " & GetXMLStringValue(objNode, "Contact") & ""
Response.Write "CostPerUnit = " & GetXMLLongValue(objNode, "CostPerUnit") & ""
Response.Write "PageHeader = " & GetXMLStringValue(objNode, "PageHeader") & ""
Response.Write "JobID = " & GetXMLStringValue(objNode, "SubmitTime") & ""
Response.Write "PageOrientation = " & GetXMLStringValue(objNode, "PageOrientation") & ""
Response.Write "PageResolution = " & GetXMLStringValue(objNode, "PageOrientation") & ""
Response.Write "PageSize = " & GetXMLStringValue(objNode, "PageSize") & ""
Response.Write "ParentTransactionID = " & GetXMLLongValue(objNode, "ParentTransactionID") & ""
Response.Write "Priority = " & GetXMLLongValue(objNode, "Priority") & ""
Response.Write "RenderingQuality = " & GetXMLStringValue(objNode, "RenderingQuality") & ""
Response.Write "ReplyEmail = " & GetXMLStringValue(objNode, "ReplyEmail") & ""
Response.Write "RetriesToPerform = " & GetXMLLongValue(objNode, "RetriesToPerform") & ""
Response.Write "SenderCSID = " & GetXMLStringValue(objNode, "SenderCSID") & ""
Response.Write "TrialsPerformed = " & GetXMLLongValue(objNode, "TrialsPerformed") & ""
Response.Write "Units = " & GetXMLLongValue(objNode, "Units") & ""

End Sub


Function GetXMLLongValue(objXMLNode,ID)
Dim objElement
Set objElement = objXMLNode.selectSingleNode(ID)
If objElement Is Nothing Then
GetXMLLongValue = -1
Else
If IsNumeric(objElement.Text) Then
GetXMLLongValue = CLng(objElement.Text)
Else
GetXMLLongValue = -1
End If
End If
Set objElement = Nothing
End Function

Function GetXMLStringValue(objXMLNode,ID)
Dim objElement
Set objElement = objXMLNode.selectSingleNode(ID)
If objElement Is Nothing Then
GetXMLStringValue = ""
Else
GetXMLStringValue = objElement.Text
End If
Set objElement = Nothing

End Function



Function GetXMLDateTimeValue(objXMLNode,ID)
Dim objElement
Set objElement = objXMLNode.selectSingleNode(ID)
If objElement Is Nothing Then
GetXMLDateTimeValue = #12:00:00 AM#
Else
If IsDate(objElement.Text) Then
GetXMLDateTimeValue = CDate(objElement.Text)
Else
GetXMLDateTimeValue = #12:00:00 AM#
End If
End If
Set objElement = Nothing
End Function

' Note: If you are faxing from behind a proxy using MS SOAP v.3, you can use one of the two following options:

'Option 1 - Use automatic detection by:
     objSoap.ConnectorProperty("EnableAutoProxy") = True

'Option 2 - Specify a proxy server:
     objSoap.ConnectorProperty("ProxyServer") = "192.168.0.100"
'and optionally, if the proxy server is password-protected specify:
     objSoap.ConnectorProperty("ProxyUser") = "Proxy Username"
     objSoap.ConnectorProperty("ProxyPassword") = "Proxy Password"