Operation Timed Out Issue

Occasional Advisor

Operation Timed Out Issue

I've been requested by a customer to integrate their shopping cart solution (uses ASP scripting languate) to use Constant Contact.  I've established an API Key under their CC account and using "WinHttp.WinHttpRequest.5.1" to establish the connection to Constant Contact to add a user to their contact list.  When I make the call, I am getting the famous "The operation timed out" error.  I am following the requirement of establishing their login as


APIKey + "%" + Username


I am using following script call to the site.  "UN" is replaced with the client's username.   pEmail has an actual email address.


    postInfo = "<entry xmlns=""http://www.w3.org/2005/Atom"">" &vbCrLF
    postInfo = postInfo & "<title type=""text""></title>" &vbCrLF
    postInfo = postInfo & "<updated>" & date &"</updated>"  &vbCrLF
    postInfo = postInfo & "<author></author>"  &vbCrLF
    postInfo = postInfo & "<id>data:,none</id>"  &vbCrLF
    postInfo = postInfo & "<summary type=""text"">Contact</summary>"  &vbCrLF
    postInfo = postInfo & "<content type=""application/vnd.ctct+xml"">"  &vbCrLF
    postInfo = postInfo & "<Contact xmlns=""http://ws.constantcontact.com/ns/1.0/"">" &vbCrLF
    postInfo = postInfo & "<EmailAddress>" & pEmail & "</EmailAddress>" &vbCrLF
    postInfo = postInfo & "<OptInSource>ACTION_BY_CUSTOMER</OptInSource>" &vbCrLF
    postInfo = postInfo & "<ContactLists>" &vbCrLF
    postInfo = postInfo & "<ContactList id=""http://api.constantcontact.com/ws/customers/UN/lists/2""></ContactList>" &vbCrLF
    postInfo = postInfo & "</ContactLists>" &vbCrLF
    postInfo = postInfo & "</Contact>" &vbCrLF
    postInfo = postInfo & "</content>" &vbCrLF
    postInfo = postInfo & "</entry>" &vbCrLF

'--- Prep data for submit export request -----

  lngTimeout = 59000
  strUserAgentString = "http_requester/0.1"
  intSslErrorIgnoreFlags = 0 ' 13056: ignore all err, 0: accept no err
  blnEnableRedirects = True
  blnEnableHttpsToHttpRedirects = True
  constantContactConn = "http://api.constantcontact.com/ws/customers/UN/contacts"
  Set xml = Server.CreateObject("WinHttp.WinHttpRequest.5.1")
  xml.SetTimeouts lngTimeout, lngTimeout, lngTimeout, lngTimeout
  xml.Open "POST", constantContactConn
  xml.setRequestHeader "Content-Type", "application/atom+xml"
  xml.Option(0) = strUserAgentString
  xml.Option(4) = intSslErrorIgnoreFlags
  xml.Option(6) = blnEnableRedirects
  xml.Option(12) = blnEnableHttpsToHttpRedirects
  xml.SetCredentials strLogin, strPassword, 0
 ' On Error Resume Next

Occasional Advisor

Re: Operation Timed Out Issue

I saw a previous post in which it was recommended to use https versus http.  I made this simple change and now it works.  Nice......

CTCT Employee

Re: Operation Timed Out Issue



I am happy that this was resolved for you.  If you run into any other issues please feel free to post them on the forum!



Benjamin Soder
NOC Analyst
Constant Contact
Developer Portal

View API documentation, code samples, get your API key.

Constant Contact Would Like To Hear From You!

We want to hear from customers like you about your favorite features and how they have helped your business or organization. Tell us by answering a few questions in...

Read More