Hi, I'm trying to determine if it's possible to display a Forecast for a United States Zip code in a SmartForm/View. The Webserice I'm using to test is: http://wsf.cdyne.com/WeatherWS/Weather.asmx?op=GetCityForecastByZIP and the value I'm using to invoke the service is 02766.
I create an Endpoints Web Service instance using the asmx web service. Then I auto generate the smart objects using the Smart Object Tester utility. When calling the GetCityForecastByZip method it appears the returning data has nested serialized data. If you look at the XML that is returned from the service (see below) you'll notice how each "Forecast" element has a "Tempatures" and "ProbabiltyOfPrecipitation" element. This results in nested serialized data as the Forecast Result element is serialized into a Forecast array. Each Forecast item them has serialized Temperatures and POP's. There is also an example of this serialized JSON data below.
What I'm ultimately trying to do is display a typical weather forecast using existing smart object, view, and form functionality to list City/State information then each days forecast. So for example, using the zip code above it would show:
Norton, MA
Forecast:
8/5/2014 Partly Cloudy 50 degrees
8/6/2014 Sunny 60 degrees
...and so on.
I can get the Date, WeatherID, and Description to display properly, but am unable to determine how to deserialize the Temperature and POP.
Any and all help is appreciated.
Thank you.
XML Returned from weather webservice.
<ForecastReturn>
<Success>true</Success>
<ResponseText>City Found</ResponseText>
<State>MA</State>
<City>Norton</City>
<WeatherStationCity>Taunton</WeatherStationCity>
<ForecastResult>
<Forecast>
<Date>2014-08-05T00:00:00</Date>
<WeatherID>2</WeatherID>
<Desciption>Partly Cloudy</Desciption>
<Temperatures>
<MorningLow/>
<DaytimeHigh>84</DaytimeHigh>
</Temperatures>
<ProbabilityOfPrecipiation>
<Nighttime/>
<Daytime>10</Daytime>
</ProbabilityOfPrecipiation>
</Forecast>
<Forecast>
<Date>2014-08-06T00:00:00</Date>
<WeatherID>1</WeatherID>
<Desciption>Thunder Storms</Desciption>
<Temperatures>
<MorningLow>65</MorningLow>
<DaytimeHigh>79</DaytimeHigh>
</Temperatures>
<ProbabilityOfPrecipiation>
<Nighttime>30</Nighttime>
<Daytime>50</Daytime>
</ProbabilityOfPrecipiation>
</Forecast>
</ForecastResult>
</ForecastReturn>
Forecast Result Array
{
"$type": "Forecast3], WeatherService2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"$values": >
{
"$type": "Forecast, WeatherService2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"Date": "2014-08-05T00:00:00",
"WeatherID": 2,
"Desciption": "Partly Cloudy",
"Temperatures": {
"$type": "temp, WeatherService2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"MorningLow": "",
"DaytimeHigh": "84"
},
"ProbabilityOfPrecipiation": {
"$type": "POP, WeatherService2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"Nighttime": "",
"Daytime": "10"
}
},
{
"$type": "Forecast, WeatherService2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"Date": "2014-08-06T00:00:00",
"WeatherID": 1,
"Desciption": "Thunder Storms",
"Temperatures": {
"$type": "temp, WeatherService2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"MorningLow": "65",
"DaytimeHigh": "79"
},
"ProbabilityOfPrecipiation": {
"$type": "POP, WeatherService2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"Nighttime": "30",
"Daytime": "50"
}
}
]
}