Question Has anyone successfully implemented reCAPTCHA within webspeed?

davidaichele

New Member
We are having issues implementing Google's reCAPTCHA within one of our webspeed pages. Does anyone have example code for the calls to Google's API?
 

Cecil

19+ years progress programming and still learning.
Which version of OPENEDGE ARE YOU USING?

When a user POST a form to your webspeed brocker , the webspeed agent need to post a request to google to verify the CAPTCHA.

Im simplified the process a bit, but what have you tried, where have you gotten to in the whole process.

Ive gotten the idea in my head that this is an existing webspeed page that you are trying to modify to use Google's reCAPTCHA
 

davidaichele

New Member
I am using Openedge10.1c

Your assumption is correct. We have an existing webspeed page that is currently using the first version of Google's Captcha. This version will become obsolete at the end of March, and we have been working on wiring up reCAPTCHA 2, with no success. Our calls to reCAPTCHA are returning the following error:
Error 411 (Length Required)    POST requests require a <code>Content-length</code> header.

I am supplying a content-length header, so I'm not sure what to try next.
 

Cecil

19+ years progress programming and still learning.
Is it possible that you can include the code on how you are doing the post to Google (excluding the client secret)?
 
Last edited:

Cecil

19+ years progress programming and still learning.
I am using Openedge10.1c

Your assumption is correct. We have an existing webspeed page that is currently using the first version of Google's Captcha. This version will become obsolete at the end of March, and we have been working on wiring up reCAPTCHA 2, with no success. Our calls to reCAPTCHA are returning the following error:
Error 411 (Length Required) POST requests require a <code>Content-length</code> header.

I am supplying a content-length header, so I'm not sure what to try next.

Out of curiosity are you also setting the 'Content-Type:' to 'application/x-www-form-urlencoded'? and the 'Accept:' to 'application/json' in the HTTP headers?

Or alternatively, try to see what happens if you set the content-length to 0 (zero)?
 
Last edited:

davidaichele

New Member
Thanks Cecil for the ideas... we've tried content types of application/x-www-form-urlencoded, and we've tried content-length of 0 as well as the length of the string being submitted.  We tried the accept application/json as well and still only get the Error 411 response.

Do you think it might be related to the version of Openedge that we are on?
 

Cecil

19+ years progress programming and still learning.
Thanks Cecil for the ideas... we've tried content types of application/x-www-form-urlencoded, and we've tried content-length of 0 as well as the length of the string being submitted. We tried the accept application/json as well and still only get the Error 411 response.

Do you think it might be related to the version of Openedge that we are on?
I don’t think it the version of OpenEdge is the issues, but it is worth upgrading anyway.

I would need to try it out for myself to try and solve the issue.

Also, are you using a PROXY Server?
 
Last edited:

Cecil

19+ years progress programming and still learning.
I've just quickly created a working example of how to use the reCAPTCHA using the WebSpeed. I'm using version 11.7, but the code should still work for version 10.1b (Unless 10.1b does not support SSL for socket connections).

Jimbobnz/ABL-reCAPTCHA

The code is basic and should not be used in a production environment blar, blar, blar, just becuase it is sooooo basic.

I was able to reproduce the Error 411 by simply commenting out the "Content-Length:" parameter in the HTTP header request.
1520984004904.png
So, it might be worth exporting the HTTP header to disk just to double check that it is syntactically correct. i.e. are you missing a double-colon ":" at the end of the parameter name?


To get the code working:
Just change the'secret'and 'sitekey' your values in the reCAPTCHA.html.
1520982585950.png

reCAPTCHAValidate.p is hardcode to work directly with Google. I can't remember is 10.1B supports JSON, so you will have to do some string parsing to get the data values.

Copy the reCAPTCHAValidate.p & reCAPTCHA.html into your ProPath of your WebSpeed Agent.

1520982340876.png
 
Last edited:

davidaichele

New Member
Cecil... you are unbelievable! I wasn't expecting you to take a stab at coding it, but I am grateful that you did. We compared your implementation to ours and they are very similar. We noticed that you were using a different port in your call, and when we made that change we were able to get past our initial error.

At this point, we are running into an SSL issue and are working with your IT team to see if it is a certificate error related to our port change.

I don't see any way on the forum to highlight you as a rockstar, but if there is a way... let me know and I will gladly give you some cred!

Thanks again!
 

Cecil

19+ years progress programming and still learning.
Cecil... you are unbelievable! I wasn't expecting you to take a stab at coding it, but I am grateful that you did. We compared your implementation to ours and they are very similar. We noticed that you were using a different port in your call, and when we made that change we were able to get past our initial error.

At this point, we are running into an SSL issue and are working with your IT team to see if it is a certificate error related to our port change.

I don't see any way on the forum to highlight you as a rockstar, but if there is a way... let me know and I will gladly give you some cred!

Thanks again!

THanks.

Ah, yes. HTTPS (SSL) goes over port 443, HTTP (clear text) goes over port 80.
Also, since you are using the OpenEdge 10.1B, the CA certificates would probably be out of date. Here are the instructions to help fix it.

How to import a certificate into the OpenEdge certificate store
 
Top