The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

Operation Timed Out Issue

Highlighted
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
  xml.Send(postInfo)

2 REPLIES 2
Highlighted
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......

Highlighted
Employee

Re: Operation Timed Out Issue

Hello,

 

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!

 

Regards,

Benjamin Soder
NOC Analyst
Constant Contact
Developer Portal

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

Visit Page

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More
Featured