Hi There,
I 'am having trouble reaching the APNS (apple Notification Service).
I get following error:
"Connection failed to open NetError = -66 SSLError = 0 WinsockError = 0"
I'm not sure what this error means.
Is there somewhere a list with explanation of all NetError's and SSLError's?
This is my code, hope someone can help me:
!Stuur push bericht
!Init
apnsHost = 'gateway.sandbox.push.apple.com'
!apnsHost = '17.172.233.65'
apnsCert = 'certificaten\cert.pem'
apnsKey = 'certificaten\key.pem'
apnsRoot = 'certificaten\AppleIncRootCertificate.pem'
apnsPort = '2195'
apnsUrl = apnsHost & ':' & apnsPort
unixDate = Today() - Deformat('19700101',@d12)
unixTime = (UnixDate * 86400) + Round(Clock()/100,1)
unixExpiry = st.LongToHex(unixTime + 86400) ! add 1 day
st.SetValue(unixExpiry)
st.FromHex()
apnsExpiry = st.GetValue()
Message('JulianDate=' & Today() & ' 01/01/1970=' & Deformat('19700101',@d12) & ' Time=' & Round(Clock()/100,1) & ' UnixDate=' & UnixDate & ' unixTime=' & unixTime & ' unixExpiry=' & Clip(unixExpiry) & ' hex=' & apnsExpiry)
json = '{{"aps" : {{ "alert" : "Hallo mijn eerste push bericht", "badge" : 1, "sound" : "default" } }'
!json = '{{"aps" : {{ "alert" : "Hallo mijn eerste push bericht", "badge" : 1, "sound" : "default" } }'
!SETCLIPBOARD(json)
deviceToken = '0b9e08cdd8baa77rdes34s3gfhh4565ggh57uhf4543gbcfc38173'
!PostString = Chr(0) & Chr(0) & Chr(32) & DeviceToken & Chr(0) & Chr(Len(Clip(json))) & Clip(jSon)
PostString = Chr(1) & '1234' & apnsExpiry & Chr(32) & DeviceToken & Chr(0) & Chr(Len(Clip(json))) & Clip(jSon)
net.CanUseProxy = 1 ! Can use a proxy
net.HeaderOnly = 0 ! We want the whole page
net.AsyncOpenUse = 1 ! Use AsyncOpen 12 seconds (recommended)
net.AsyncOpenTimeOut = 1200 ! Up to 12 seconds to connect
net.InActiveTimeout = 9000 ! Set IdleTimeout 90 seconds
net.ConnectionKeepAlive = 0
! These settings would be required if you were talkig to a SOAP server that only did SSL.
Net.SSL = 1
net.SSLCertificateOptions.CertificateFile = apnsCert
net.SSLCertificateOptions.PrivateKeyFile = apnsKey
net.SSLCertificateOptions.CARootFile = apnsRoot !'.\CaRoots.pem'
net.SSLCertificateOptions.DontVerifyRemoteCertificateCommonName = 1
net.SSLCertificateOptions.DontVerifyRemoteCertificateWithCARoot = 1
! If https use a root cluster like '.\CA_Roots.pem'
!net.AsyncOpenUse = 1
!net.AsyncOpenTimeOut = 1200 ! 12 sec
!net.InActiveTimeout = 9000 ! 90 sec
net.ContentType = 'text/xml; charset=utf-8'
net.AcceptEncoding = ''
net.ContentLength = Len(Clip(PostString))
! Set the SOAPAction header to tell the web service which method to execute
!net.customheader = 'SOAPAction: "
http://www.egem.nl/StUF/sector/bg/0310/aoaLv01"'
SetCursor(Cursor:Wait)
net.Post(apnsUrl, PostString)
If net.Error
Message ('Could not post the request to this web service. Error ' & net.Error & ': ' & net.InterpretError())
SetCursor()
End
Regards Joep
Clarion 6,3
Nettalk 7,05