I am a novice in web services and I am trying to write script in TestComplete to read mail from mail web server. I am at lost at what to do and I will appreciate any help I can get. Below is my code I have so far, and not able to access the Mail Web Server. When I used bugger to look at what is going on, I see an error that says "Could not convert varient of type(olestr) into type (Dispatch) " and the Logfile is all garbage.
Please the attached file
Thanks for your help.
Function ReceiveEMail()
Dim objXmlHttp
Dim oXmlHttp
Dim xmlDOMParams
Dim xmlDOMParamsAttachement
Dim xmlNdLstDonation, xmlNdLstDonation1
Dim PropstatNodes,xmlGetEmailSubject
Dim HrefNodes,XMLBody,XMLResponse
Dim StatusNode,NewerVersion
Dim str, RdHeader
Dim browserVersion
Dim NewerbVersion, OlderbVersion
'****Client Access Server *****
Const strUrl = "
https://mail.sciemetric.com/exchange/ts/inbox" 'URL to CAS
Const strUser = "sciemetric\Bob001" 'Domain and Username to authenticate with
Const strPassword = ""myExchangeUSeRsP4ssw0rd"
' Const strEmailAddress = "" 'Mailbox that you want to read data from
NewerbVersion = "HigherVersion"
OlderbVersion = "LowerVersion"
Delay(2000)
'Get Browers type and version
browserVersion = GetBrowsers()
intCompare = StrComp(browserVersion, NewerbVersion, vbTextCompare)
if intCompare = 0 Then
'code for IE7+, Firefox, Chrome, Opera, Safari
'xmlhttp=new XMLHttpRequest();
Set objXmlHttp = CreateObject("MSXML2.XMLHTTP")
else
'Create An XMLHTTP Object for for IE6, IE5
'objXmlHttp =new ActiveXObject("Microsoft.XMLHTTP")
objXmlHttp = CreateObject("Microsoft.XMLHTTP")
End if
' MSXML2.ServerXMLHTTP40
Set xmlDOMParams = Sys.OleObject("Msxml2.DOMDocument.4.0")
' Set objXmlDoc = CreateObject("MSXML2.DOMDocument.6.0") 'this will parse the response for us
''****Open and read all the mails of inbox*************'
'*.open("PROPFIND", ConnectingURL, False, UserName, PWD)
'*.open("DELETE", strurl, False, UserName, PWD)
'*.open("GET", strattachmentUrl, False, UserName, PWD)
'*.open("X-MS-ENUMATTS", strUrl, False, UserName, PWD)
'*******************************************************'
Delay(2000)
' objXmlHttp.open "GET",strUrl,False,strUser,strPassword
objXmlHttp.open "GET",strUrl,False,strUser,strPassword
'objXmlHttp.setRequestHeader "Depth","1"
objXmlHttp.setRequestHeader "Content-Type","xml"
objXmlHttp.setRequestHeader "Depth","1"
objXmlHttp.send()
While objXmlHttp.readyState <> 4
objXmlHttp.waitForResponse 1000
Wend
' if ((objXmlHttp.status = 200) Or (objXmlHttp.status = 0)) Then
XMLBody = objXmlHttp.responseBody
Log.Message(objXmlHttp.responseBody)
Delay(2000)
Set XMLResponse = objXmlHttp.responseXML
Debug.Write(objXmlHttp.responseXML)
'Get the Attachment
str = objXmlHttp.responseText
Log.Message(str)
'Load the read mails into XML document'''
xmlDOMParams.LoadXml(str)
set xmlNdLstDonation1 = xmlDOMParams.GetElementsByTagName("a:href")
Log.Message( xmlNdLstDonation1.Item(0))
RdHeader = objXmlHttp.getResponseHeader("Content-Type")
Log.Message("Email Header: " & RdHeader)
'''Get the list of text descriptions of all the mails'''
set xmlNdLstDonation = xmlDOMParams.GetElementsByTagName("e:textdescription")
Log.Message(xmlNdLstDonation.Item(0))
'''Get the List of Subjects of all the mails'''
set xmlGetEmailSubject = xmlDOMParams.GetElementsByTagName("d:subject")
Log.Message(xmlGetEmailSubject.Item(0))
' else
' End if
'Reset Object to null to free up objects
Set objXmlHttp = Nothing
Set xmlDOMParams = Nothing
End Function