Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X
Hello,
I am having trouble with the 2 services which get the weather information from open weather and yahoo weather site. I have implemented them just like in the tutorials, but I´m receiving the following error codes:
[context: com.thingworx.webservices.context.HttpExecutionContext@511e1e46][message: Execution error in service script [WeatherThing GetYahooWeatherInformation] : Wrapped org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog. Cause: Content is not allowed in prolog.]
[context: com.thingworx.webservices.context.HttpExecutionContext@6b492dd3][message: Execution error in service script [WeatherThing GetOpenWeatherForecastData] : Wrapped java.net.MalformedURLException: no protocol: api.openweathermap.org/data/2.5/weather?lat=39.0&lon=-111.0&units=imperial&type=accurate&mode=xml Cause: no protocol: api.openweathermap.org/data/2.5/weather?lat=39.0&lon=-111.0&units=imperial&type=accurate&mode=xml]
Can you please advise?
Two days ago the services were functional and I did not change anything.
Enclosed you can find the project files.
Thank you,
Kübra Kabak
Hi,
The Open Weather API requires an API Key now. You can create yourself one at this website or you can use one that I have created for test 4abc8a3c9f101ccf9c7cfe7cbf3dfed7.
You need to append &APPID=4abc8a3c9f101ccf9c7cfe7cbf3dfed7 (or your own api key value) at the end of the Open Weather URL in the GetYahooWeatherInformation service at line 97
var params = {
url: "http://api.openweathermap.org/data/2.5/weather?q="+cityName+"&type=accurate&mode=xml&APPID=4abc8a3c9f101ccf9c7cfe7cbf3dfed7"
/* STRING */,
timeout: 60 /* NUMBER */
};
And in the GetOpenWeatherForecastData; service at line 6
var params = {
url: "http://api.openweathermap.org/data/2.5/forecast?lat="+lat+"&lon="+long+"&units=imperial&type=accurate&mode=xml&APPID=4abc8a3c9f101ccf9c7cfe7cbf3dfed7" /* STRING */,
timeout: 160 /* NUMBER */
};
You shouldn't have any more errors now.
Veronica
I am facing the same problem. I have followed the above instruction but still I am facing the same problem.
I also facing problem in server authentication, I have my own username and password but sometime a pop up comes which require authentication.For that it doesn't take my username password.
can you please advice?
Hi Vinay,
Please note that yahoo weather api is no longer in service. Please check the post below for a working implementation of the OpenWeatherMap API service call :
https://community.thingworx.com/message/43348?et=watches.email.thread#43348
Let me know if you are in need of further assistance.
Veronica