Sales
Click for numbers
Welcome User Tools Developer Tools Prices Help Sign up Login
You are here: Home > Developer Tools > Fax Web Service > Samples > ASP - View the status of a fax in XML structure

View the status of a fax from ASP, 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", 9999999, 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 "<BR><B>Fax Transaction:</B><BR>"
Response.Write "====================<BR>"
Response.Write "TransactionID = " & GetXMLLongValue(objNode, "TransactionID") & "<BR>"
Response.Write "FaxNumber = " & GetXMLStringValue(objNode, "DestinationFax") & "<BR>"
Response.Write "Subject = " & GetXMLStringValue(objNode, "Subject") & "<BR>"
Response.Write "TimeSubmitted = " & GetXMLDateTimeValue(objNode, "SubmitTime") & "<BR>"
Response.Write "TimeCompleted = " & GetXMLDateTimeValue(objNode, "CompletionTime") & "<BR>"
Response.Write "TimePostponed = " & GetXMLDateTimeValue(objNode, "PostponeTime") & "<BR>"
Response.Write "PagesSubmitted = " & GetXMLLongValue(objNode, "PagesSubmitted") & "<BR>"
Response.Write "PagesSent = " & GetXMLLongValue(objNode, "PagesSent") & "<BR>"
Response.Write "Duration = " & GetXMLLongValue(objNode, "Duration") & "<BR>"
Response.Write "Status = " & GetXMLLongValue(objNode, "Status") & "<BR>"
Response.Write "RemoteCSID = " & GetXMLStringValue(objNode, "RemoteCSID") & "<BR>"
Response.Write "Contact = " & GetXMLStringValue(objNode, "Contact") & "<BR>"
Response.Write "CostPerUnit = " & GetXMLLongValue(objNode, "CostPerUnit") & "<BR>"
Response.Write "PageHeader = " & GetXMLStringValue(objNode, "PageHeader") & "<BR>"
Response.Write "JobID = " & GetXMLStringValue(objNode, "SubmitTime") & "<BR>"
Response.Write "PageOrientation = " & GetXMLStringValue(objNode, "PageOrientation") & "<BR>"
Response.Write "PageResolution = " & GetXMLStringValue(objNode, "PageOrientation") & "<BR>"
Response.Write "PageSize = " & GetXMLStringValue(objNode, "PageSize") & "<BR>"
Response.Write "ParentTransactionID = " & GetXMLLongValue(objNode, "ParentTransactionID") & "<BR>"
Response.Write "Priority = " & GetXMLLongValue(objNode, "Priority") & "<BR>"
Response.Write "RenderingQuality = " & GetXMLStringValue(objNode, "RenderingQuality") & "<BR>"
Response.Write "ReplyEmail = " & GetXMLStringValue(objNode, "ReplyEmail") & "<BR>"
Response.Write "RetriesToPerform = " & GetXMLLongValue(objNode, "RetriesToPerform") & "<BR>"
Response.Write "SenderCSID = " & GetXMLStringValue(objNode, "SenderCSID") & "<BR>"
Response.Write "TrialsPerformed = " & GetXMLLongValue(objNode, "TrialsPerformed") & "<BR>"
Response.Write "Units = " & GetXMLLongValue(objNode, "Units") & "<BR>"

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"




About | Contact | Privacy | Terms | Partners | Login | System Status

© Interfax Inc