Quantcast
Channel: SCN : All Content - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6745

XS Engine HTTP Request: resolving DNS host name failed

$
0
0

Hi Experts

 

I've written the following code

 

Images.xshttpdest

 

host = "www.loc.gov";

port = 80;

description = "Library of Congress Images";

pathPrefix = "/pictures/search/?fo=json&q=";

authType = none;

useProxy = true;

proxyHost = "proxy";

proxyPort = 8080;

timeout = 0;

 

 

searchImages.xsjs

 

function searchImages(){

  var search = $.request.parameters.get("search");

  var index = $.request.parameters.get("index");

  if(index === undefined){

  index = 0;

  }

  var dest = $.net.http.readDestination("TM.crawler", "images");

 

  var client = new $.net.http.Client();

  var req = new $.web.WebRequest($.net.http.GET, search);

  client.request(req, dest);

 

  var response = client.getResponse();

 

  var body;

  if(response.body){body = response.body.asString(); }

  $.response.status = response.status;

  if(response.status === $.net.http.INTERNAL_SERVER_ERROR){

  $.response.contentType = "application/json";

  $.response.setBody('body');

  }

  else{

  $.response.contentType = "text/html";

  var searchDet = JSON.parse(body);

  var outBody =

  'First Result of ' + searchDet.search.hits + '</br>'+

  '<img src="' + searchDet.results[index].image.full + '">';

  $.response.setBody( outBody );

  }

}

searchImages();

 

Found the following

 

Error: HttpClient.request: request failed. The following error occured: unable to establish connection to proxy:8080 - internal error code: resolving DNS host name failed (line 11 position 0 in /TM/crawler/searchImages.xsjs)

 

 

Can you suggest me solutions.


Viewing all articles
Browse latest Browse all 6745

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>