I have created an adapter with this method:
function getLocation(gpsLat, gpsLong) {
path = "/maps/api/geocode/json?latlng=" + gpsLat + "," + gpsLong + "&sensor=false";
var input = {
method : 'get',
returnedContentType : 'json',
path : path
};
return WL.Server.invokeHttp(input);
}
the adapter configuration is this:
<displayName>GPSLocator</displayName>
<description>GPSLocator</description>
<connectivity>
<connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
<protocol>http</protocol>
<domain>maps.googleapis.com</domain>
<port>80</port>
<!-- Following properties used by adapter's key manager for choosing specific certificate from key store
<sslCertificateAlias></sslCertificateAlias>
<sslCertificatePassword></sslCertificatePassword>
-->
<proxy>
<protocol>http</protocol>
<domain>15.1.0.111</domain>
<port>8080</port>
</proxy>
</connectionPolicy>
<loadConstraints maxConcurrentConnectionsPerNode="2" />
</connectivity>
<procedure name="getLocation" />
when i right-click and run Invoke WL Adapter i get this error:
{
"errors": [
"Runtime: Http request failed: org.apache.http.conn.HttpHostConnectException: Connection to http:\/\/maps.googleapis.com:80 refused"
],
"info": [
],
"isSuccessful": false,
"warnings": [
]
}
if i run a request in google maps from my browser, for example: https://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=false
then i get correct response. So the problem is by calling it from WL.
I am using worklight studio 6.1 Also i can access my console normally and see deployed apps, so my server is up and running properly.
Any suggestions?