ibm mobilefirst - Invoke Worklight Adapter http error -
i have created adapter 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 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 adapter's key manager choosing specific certificate 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 right-click , run invoke wl adapter error:
{ "errors": [ "runtime: http request failed: org.apache.http.conn.httphostconnectexception: connection http:\/\/maps.googleapis.com:80 refused" ], "info": [ ], "issuccessful": false, "warnings": [ ] }
if run request in google maps browser, example: https://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=false
then correct response. problem calling wl.
i using worklight studio 6.1 can access console , see deployed apps, server , running properly.
any suggestions?
i believe has proxy running through following settings:
<proxy> <protocol>http</protocol> <domain>15.1.0.111</domain> <port>8080</port> </proxy>
i able run above adapter without proxy in place. may want proxy configuration. have request going through http inside adapter have going through https in example address here:
https://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=false
Comments
Post a Comment