cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Problem in Weather App

mvolanti
8-Gravel

Problem in Weather App

Hi,

i've got a problem with the service GetYahooWeatherInformation.

When i test the service tw said me the exception: Wrapped org.apache.http.NoHttpResponseException: xml.weather.yahoo.com:80 failed to respond Cause: xml.weather.yahoo.com:80 failed to respond.

Can anyone help me??

2 REPLIES 2
ttielebein
14-Alexandrite
(To:mvolanti)

Hello, what does the REST call to yahoo look like, the one which gives you this error (or rather, the part of the service which actually attempts to call Yahoo). A lot of Yahoo's weather REST API is deprecated. There is documentation demonstrating how to retrieve weather information from Wunderground located here: https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS228421

Hope this helps!

Tori

Hi,

As mentioned in https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS228421, i created a a mashup, when i am trying to execute, i go the following error.

17:06:34 ERROR - Error in invoking service DynamicThingTemplates_WeatherTemplate, GetYahooWeatherInformation, Things, Beta, Services, GetYahooWeatherInformation. Error from the server: "Wrapped org.apache.http.conn.HttpHostConnectException: Connect to api.wunderground.com:80 [api.wunderground.com/104.64.150.10] failed: Connection timed out: connect Cause: Connect to api.wunderground.com:80 [api.wunderground.com/104.64.150.10] failed: Connection timed out: connect".


My service script is as follows:

// Need to make a free wunderground.com account to get this key

var apiKey = "381603bc1002b5ce";

var temperature;

var humidity;

  //Inputted location needs to be valid lat, long: 40.7127, 74.0059

if(location != null){

     var test = location + " ";

    var arrayLocations = test.split(",");

    var lat = arrayLocations[0];

    var long = arrayLocations[1];

     var prm = {

        url: "http://api.wunderground.com/api/"+apiKey+"/conditions/q/"+lat+","+long+".json",timeout: 60000

    };

     var json = Resources["ContentLoaderFunctions"].PostJSON(prm);

  try {

        temperature = parseInt(json.current_observation.temp_f);

        humidity = parseInt(json.current_observation.relative_humidity);

        me.Temperature = temperature;

        me.Humidity = humidity;

        result = "Success. Properties are updated.";

          } catch(err) {

        logger.error("Could not parse temperature and humidity for location: " + location

           + ". All valid Longitudes and Latitudes values must have decimal points"                      + " and be located where weather measurements are commonly taken (near cities).");

        result = "Failed. Check Script Logs";

    }

}

But when i am trying to enter the URL via chrome browser (http://api.wunderground.com/api/381603bc1002b5ce+/conditions/q/16.57039022046052,77.50030517578125.json)

i got the results properly in JSON format.

But when i am trying to execute from mashup, the got the error.

can anyone help me to resolve the issue.

Thanks in Advance

Gnanamuthu Lucas

Announcements


Top Tags