Hi Kevin
Yes if the client closed I would be happy. As I said the problem seem to be that it never arrives at PageReceived or ErrorTrap
I also saw that the documentation stated that the Webclient would be intialised and closed but when I ran the code I got an error Not initialised. After adding the init the app worked (sort of ;-)
Maybe the best is for me to layout what I have got:
I created a Window with 2 buttons
SendSMS and close
Added StringTheory object st
Added NetTalk or NetSimple Object BaseClass NetWebClient ObjectName ThisWebClient Settings Supress Error Messages
In WindowManager Init After opening the window Quickwindow{prop:hide} = 1
post(event:accepted,?SMSSend)
In ?SMSSend AcceptedSMSMessage = pSMSMessage! 'This message is a speed SMS test from Genweb using a created URL'
SMSNumber = pSMSNumber!'27824410959'
URL = '
https://www.winsms.co.za/api/batchmessage.asp'
URL = CLIP(URL) & '?User=' & CLIP(gs:WinSMSUserName) & '&Password=' & CLIP(gs:WinSMSPassword)
URL = CLIP(URL) & '&Message=' & CLIP(SMSMessage) & '&Numbers=' & CLIP(SMSNumber)
!URL = '
http://www.davcomm.co.za' !If I enable this line the app works as expected
st.Trace('URL ' & CLIP(URL)) !This generates the correct URL
ThisWebClient.Init()
ThisWebClient.SetAllHeadersDefault()
ThisWebClient.CanUseProxy = 1
ThisWebClient._HTTPVersion = 'HTTP/1.1'
ThisWebClient.AsyncOpenUse = 1
ThisWebClient.AsyncOpenTimeOut = 1200
ThisWebClient.InActiveTimeout = 9000
ThisWebClient.HeaderOnly = 0
!ThisWebClient.OptionDontRedirect = DontRedirect !I have remmed this out in the application because it throws an error
ThisWebClient.SSLMethod = NET:SSLMethodTLSv1_2
ThisWebClient.Fetch(URL)
In ?Close post(event:closewindow)
Send Procedureif self.packet.binDataLen > 0
PageSent = self.packet.binData[1 : self.packet.binDataLen] & '<13,10>-----------------<13,10>' & PageSent
end
st.trace('Inside Send Page Sent: ' & SUB(PageSent,1,80))
st.trace('Inside Send Page Sent: ' & SUB(PageSent,81,80))
st.trace('Inside Send Page Sent: ' & SUB(PageSent,161,80))
st.trace('Inside Send Page Sent: ' & SUB(PageSent,241,80))
PageReceivedst.Trace('Inside received')
st.trace('Downloaded ' & ThisWebClient.PageLen & ' bytes')
PageString = ThisWebClient.Page [1 : ThisWebClient.PageLen]
st.trace('Page String ' & CLIP(PageString))
ThisWebClient.Kill()
POST(EVENT:CloseWindow)
ErrorTrapst.Trace('inside error trap')
temp2 = self.InterpretError()
if self.error = 0
temp2 = clip(errorStr) & '.'
else
temp2 = clip(errorStr) & '.' & ' The error number was ' & self.error & ' which means ' & clip(temp2) & '.'
end
if self.error = ERROR:OpenTimeOut or (self.Error >= ERROR:SSLGeneralFailure and self.Error < ERROR:NetTalkObjectAndDLLDontMatch)
! Also list the WinSock or SSL Errors
if self.WinSockError
temp2 = clip(temp2) & ' - [WinSock Error = ' & self.WinSockError & ' : ' & clip (NetErrorStr (self.WinSockError)) & ']'
end
if self.SSLError
temp2 = clip(temp2) & ' - [SSL Error = ' & self.SSLError & ']'
end
end
st.trace('Error: ' & CLIP(temp2))
I appreciate the time you have spent looking at this.