title: How to make HTTPS requests with serverside javascript using Worklight?
body: <p>I'm toying around with <a href="http://www-01.ibm.com/software/mobile-solutions/worklight/">IBM worklight</a>, and am trying to create an adapter to feed some data in from the <a href="https://developers.google.com/places/documentation/">Google places API</a>.</p>
  
  <p>I want to call this URL :</p>
  
  <pre><code>https://maps.googleapis.com/maps/api/place/search/json?key=AIzaSyCTlPms1pvhzeoRrBao5qW-DJMI_CWcbAM&amp;location=52.0700,1.1400&amp;radius=10000&amp;sensor=false&amp;name=coffee
  </code></pre>
  
  <p>Executing this URL works fine in a browser, and displays some nice JSON that I'm trying to obtain via Worklight.</p>
  
  <p>The Worklight adapters are created in Javascript, this is what I have so far :</p>
  
  <pre><code>function getCoffeeHouses() {
  
      var input = {
          method : 'get',
          returnedContentType : 'json',
          path : 'maps/api/place/search/json',
          parameters : {
              'key'       :   'AIzaSyCTlPms1pvhzeoRrBao5qW-DJMI_CWcbAM',
              'location'  :   '52.0700,1.1400',
              'radius'    :   '10000',
              'sensor'    :   'false',
              'name'      :   'coffee' 
          }
      };
  
      var response = WL.Server.invokeHttp(input);
  
   // Extract latitude and longitude from the response.
      var type = typeof response; 
      if ("object" == type) {
          if (true == response["isSuccessful"]) {
              // Return JSON object with lat and lng.
              return response["results"];
          } 
          else {
              // Returning null. Web request was not successful.
              return null;
          }
      } 
      else {
          // Returning null. Response is not an object.
          return null;
      }
  }
  </code></pre>
  
  <p>And this is the result that I get in the console, when I test the above:</p>
  
  <pre><code>Failed to parse JSON string
  &lt;!DOCTYPE html&gt;
  &lt;html lang=en&gt;
    &lt;meta charset=utf-8&gt;
    &lt;meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width"&gt;
    &lt;title&gt;Error 404 (Not Found)!!1&lt;/title&gt;
    &lt;style&gt;
      *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* &gt; body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}
    &lt;/style&gt;
    &lt;a href=//www.google.com/&gt;&lt;img src=//www.google.com/images/errors/logo_sm.gif alt=Google&gt;&lt;/a&gt;
    &lt;p&gt;&lt;b&gt;404.&lt;/b&gt; &lt;ins&gt;That’s an error.&lt;/ins&gt;
    &lt;p&gt;The requested URL &lt;code&gt;/maps/api/place/search/json?key=AIzaSyCTlPms1pvhzeoRrBao5qW-DJMI_CWcbAM&amp;amp;location=52.0700%2C1.1400&amp;amp;radius=10000&amp;amp;sensor=false&amp;amp;name=coffee&lt;/code&gt; was not found on this server.  &lt;ins&gt;That’s all we know.&lt;/ins&gt;
  Caused by: java.io.IOException: Unexpected character '&lt;' on line 1, column 1
  [2012-07-23 11:08:57] An error occurred while invoking procedure CoffeeFinder/getCoffeeHouses parameters: {
     "arr": [
     ]
  }
  null
  Caused by: null
  </code></pre>
  
  <p>I think, that this is probably caused because the adapter is requesting as HTTP, whereas it should be using HTTPS. </p>
  
  <p>If I alter the request to use HTTP in a browser, it displays similar results.</p>
  
  <p><strong>Question : Can I make an HTTPS request by altering the above Javascript, or am I misunderstanding worklight adapters?</strong></p>