Google API - Help!

Imports, export, webservices, custom integration work, 3rd party software plugins etc. Questions about these topics live here.
revellbikes
Posts: 428
Joined: Fri Jun 15, 2012 12:44 pm
Has thanked: 11 times
Been thanked: 43 times

Google API - Help!

Post by revellbikes » Mon Oct 20, 2014 9:56 am

Morning all,

I'm trying to get the Google API working with Proclaim using HTTP Services Admin.

I'll start with what I've got so far:

ID: 003
Description: GoogleAPI
WEB Address: https://maps.googleapis.com/maps/api/pl ... xml?input=
Agent:
Port: 443
Context: text/xml
Timeout(Secs): 5
Mode: POST,GET


URL Parameters:

Input: {GoogleAutoCompleteInput.Text}
Types: {GoogleAutoCompleteTypes.Text}
Key: My key generated online

SEND Options - Nothing selected
RECEIVE Options - XML Import - GoogleAutoComplete

This is generating the attached error when I process the linked action I have setup. I assume I need to install a certificate or two in the Certs folder on each machine running this service. But where do I obtain such a certificate, a quick search on the net wasn't very fruitful...

I also guessed at the WEB Address field, I'm not sure how Proclaim builds up the rest of the address when it runs.
Attachments
Certs Error.PNG
Certs Error.PNG (20.34 KiB) Viewed 4849 times

steve
Posts: 384
Joined: Wed Nov 30, 2011 10:20 pm
Been thanked: 77 times

Re: Google API - Help!

Post by steve » Mon Oct 20, 2014 11:05 am

Hi,
1) - remove the ?input= from your web address
the parameters section of the HTTP service adds these in for you.
2) certificates:
at the risk of incurring the wrath, do you need to use HTTPS? alternatively change the url to HTTP:// and port 80 and have no cert issues
or, this is how I do it:
to obtain and install the certificates is a little fiddly.
run Internet Explorer as Local Admin
navigate to https://www.google.co.uk
click on the padlock security report in the address bar then click VIEW Certificates
Image

click "Certification Path" tab - you'll see the certificate chain of 3 certificates that you need to download and install on each machine (!).
Image
Cert 1:
go to the Details Tab, and click Copy to File...
go through the Certificate Export Wizard and click NExt all the way
(format = DER enc binary x.509 .CER)
save the file as e.g. google_3.CER somewhere useful.
(you'll be saving three certificates, this is the 'last' one in the tree)
Complete the wizard, to get you back to the Certificate Window
on the Certification Path tab, this time click on the middle tier - "Google Internet Authroity G2"
and click the button "View Certificate"
this will open up another certificate window.
Repeat the process for saving the certificate - anmely click "Details" tab and "Copy to file" again - saving as google_2.CER.
close this certificate window.
Finally, repeat for the top level cert: in the original Certificate window, Certification Path tab, click the top level cert - "GeoTrust Global CA"
and View Certificate.
once again click details--copy to file and save as google_1.CER

You'll now have 3 .CER files for the google certification path. put these on your network drive - perhaps in the same place as the RTA portal certs if you are using this.
next you'll have to write a batch file to install these certs into Progress on each client machine.
You can adapt the batch script supplied for the RTA A2A portal in the PRoclaim client install directory, then deploy this as a startup script using Active Directory.
Ill post a sample script here if I get a chance, but it's fairly straighforward.

This should get rid of your Progress SSL error message.

I would suggest installing Wireshark at this point and doing a few trial calls to the HTTP (NOT the HTTPS) service in PRoclaim and monitoring the output - this will tell you if your outbound request is properly formatted, and that Proclaim is parsing the correct response. You can extract a raw XML response from wireshark and use this as the basis of an XML import template.

revellbikes
Posts: 428
Joined: Fri Jun 15, 2012 12:44 pm
Has thanked: 11 times
Been thanked: 43 times

Re: Google API - Help!

Post by revellbikes » Mon Oct 20, 2014 11:35 am

Thanks Steve,

I found some instructions on the Progress KB site which indicated I needed to download a specific certificate called Equifax_Secure_Certificate_Authority.pem from http://www.geotrust.com/resources/root_ ... rtificates

I did try the export in IE method that you mentioned above but it didn't work for me until I'd run the MKHASHFILE Command on the above Equifax file.

I'm no longer getting the SSL Certificate errors now but the output fields remain blank and the message I have in place for the return-value is also blank...

It sounds like I need to run some debugging like you say

revellbikes
Posts: 428
Joined: Fri Jun 15, 2012 12:44 pm
Has thanked: 11 times
Been thanked: 43 times

Re: Google API - Help!

Post by revellbikes » Tue Oct 21, 2014 8:58 am

I've installed Wireshark and attempted to capture the events that occur during the HTTP transaction within Proclaim.

As a Wireshark virgin, I'm afraid the resulting content is a little foreign to me. I've managed to locate what I think is the start of the outbound query on maps.googleapis.com
Wireshark.PNG
Wireshark.PNG (12.28 KiB) Viewed 4810 times
I'm not entirely sure how I can formulate an XML import template from the response given by Wireshark. Are there any tags I should be looking out for?

Cheers

revellbikes
Posts: 428
Joined: Fri Jun 15, 2012 12:44 pm
Has thanked: 11 times
Been thanked: 43 times

Re: Google API - Help!

Post by revellbikes » Tue Oct 21, 2014 10:18 am

**UPDATE**

I gather I'm looking for "HTTP/XML" in the protocol column - I can confirm there are no entries for HTTP/XML :roll:

steve
Posts: 384
Joined: Wed Nov 30, 2011 10:20 pm
Been thanked: 77 times

Re: Google API - Help!

Post by steve » Tue Oct 21, 2014 3:24 pm

here is the wireshark capture for the Google distance API called from within Proclaim- same theory, different endpoint, but it shows the outbound frame and inbound XML response

note the filter done on ip address and protocol (http) to narrow things down first of all,

you can see first the outbound http response and how the parameters have been inserted,

then in the result frame, I have drilled down into the frame, right-click on "eXtensible Markup Language" and drilldown as shown to copy the XML into clipboard - paste into notepad and save as XML then you can use this as a template for your XML import template.
(2 screenshots below).

HTH
Steve
outbound frame:
Image
inbound frame:
Image

revellbikes
Posts: 428
Joined: Fri Jun 15, 2012 12:44 pm
Has thanked: 11 times
Been thanked: 43 times

Re: Google API - Help!

Post by revellbikes » Wed Oct 22, 2014 11:24 am

progress at last...

The Wireshark log didn't contain any HTTP/XML data unfortunately so I turned my attention to SOAPUI and managed to build up the REST request in there. This returned an error stating that my API Key wasn't permitted to use this service. After bashing my head off the desk for some time I realised that I needed to provide payment details, not to charge me but as an ID verification, but this was far from obvious!

Entered my details and then the requests are flying in and out no problem.

As I think has been mentioned before on here, it's use as a postcode lookup facility may be a little limited as it doesn't provide much information. I have a few ideas for how else it could be applied though :roll:

Many thanks for your help on this one - chuffed with the outcome!

Bibliotech
Posts: 2
Joined: Thu Apr 14, 2016 8:41 am

Re: Google API - Help!

Post by Bibliotech » Thu Apr 14, 2016 8:52 am

Hey all sorry for resurrecting this topic.

I'm trying to implement this as per the instructions and unfortunately I've hit an issue where I'm getting the following message when running the HTTPS call.

Unable to connect to Web Socket using: -ssl -H maps.googleapis.com -S 443 -nohostverify
Secure Socket Layer (SSL) failure. error code -54: unable to get local issuer certificate: for 594f1775.0 in C:\OpenEdge\102b\certs (9318)


I've followed the instructions regarding the cerificates and installed. I've also followed the link to the equifax secure certificate which is now expired but found a new link for the certificate and again implemented into Proclaim but I'm getting the same message.

It looks like the API call is now locked down to only accept HTTPS requests as sending via http brings back the following error

<?xml version="1.0" encoding="UTF-8"?>
<DistanceMatrixResponse>
<status>REQUEST_DENIED</status>
<error_message>Requests to this API must be over SSL. Load the API with "https://" instead of "http://".</error_message>
</DistanceMatrixResponse>


Just wondering if anyone could help as to what certificates are now needed if anyone has done a recent setup for this?

revellbikes
Posts: 428
Joined: Fri Jun 15, 2012 12:44 pm
Has thanked: 11 times
Been thanked: 43 times

Re: Google API - Help!

Post by revellbikes » Thu Apr 14, 2016 9:17 am

Does it work outside of Proclaim?

Nate
Posts: 46
Joined: Fri Oct 26, 2012 12:56 pm
Been thanked: 3 times

Re: Google API - Help!

Post by Nate » Thu Apr 14, 2016 12:33 pm

Have you checked to see if the certificate file "594f1775.0" exists in the referred location "C:\Progress\Openedge11\cert"?

It is strange if you are getting those error messages with certificates imported correctly

If you have both 3.3 and 3.2 installed on your site, it may have gone into the "C:\Progress\Openedge11\certs" folder instead of "C:\Openedge..." depending how your batch file has been set up.

Post Reply