Web Connection
National Weather Service forecast
Gravatar is a globally recognized avatar based on your email address. National Weather Service forecast
  Harvey Mushman
  All
  May 30, 2015 @ 11:37am
PS - I just discovered something else... (maybe this helps?)
?? Schema ??

Starting here.....


After downloading and installing West Wind Proxy Generator, I pointed the WSDL URL at the following address:

http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl

This generated a VFP class called "ndfdXMLProxy.prg". Next I ran the following:

DO wconnect
DO ndfdxmlproxy.prg
o=CREATEOBJECT('ndfdxmlproxy')
cLatLon = o.latlonlistzipcode('90291') && target zip code for Venice California
? cLatLon

Which created the following XML:

<?xml version='1.0'?><dwml version='1.0' xmlns:xsd='<<span class="elements"><a href="http://www.w3.org/2001/XMLSchema" target="top" >http://www.w3.org/2001/XMLSchema<<span class="elements"></a>>' xmlns:xsi='<<span class="elements"><a href="http://www.w3.org/2001/XMLSchema-instance" target="top" >http://www.w3.org/2001/XMLSchema-instance<<span class="elements"></a>>' xsi:noNamespaceSchemaLocation='<<span class="elements"><a href="http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd" target="top" >http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd<<span class="elements"></a>>'><latLonList>33.9944,-118.464</latLonList></dwml>

The "latLonList" contains a coordinate pair for Santa Monica Airport which is the closest weather station to the desired zip code. It is my understanding this is how the weather service works, first you enter a zip code then they return the closest station. And then from there you enter the Latitude and Longitude of the station and make a second request for the parameters (temperature, wind, rain...) you are seeking to know about.

Here is a link that describes all of the possible Request types:

Request Types

And here is a link that let's you test the system:

Example Test Page

Now I need to figure out how to extract the XML "latLonList" as an object or a string before passing it back to the service for the weather forecast.

I think the next request call will be to the service described as:

VFP FUNCTION NDFDgen(...)

This function requires the following parameters:

FUNCTION NDFDgen(latitude as Decimal,longitude as Decimal,product as String,startTime as DateTime,endTime as DateTime,Unit as String,weatherParameters as weatherParametersType) as String

This is what the function looks like:

To understand the "weatherParameters" which relates back to what information the request should return, I've found the following documentation:

WeatherParameters

Now how to put it all together? <g> Maybe the missing Schema tat would allow the service to create an object was discovered (see my PS at the top of this post). Otherwise, I guess I'm wondering how to create a boiler plate object so wwXML.XMLToObject() will return a way to look at the XML results. Having to manually parse this data would be a real pain...!

Thanks

Gravatar is a globally recognized avatar based on your email address. Re: National Weather Service forecast
  Rick Strahl
  Harvey Mushman
  May 30, 2015 @ 04:28pm

weatherParameter is probably an Enum.

You probably need to set the enum value like this and then pass the ComValue reference into the method:
wcdocs:_3ld0yy8uh.htm

At least the input API is strongly so, let the .NET proxy help you.

+++ Rick ---


PS - I just discovered something else... (maybe this helps?)
?? Schema ??

Starting here.....


After downloading and installing West Wind Proxy Generator, I pointed the WSDL URL at the following address:

http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl

This generated a VFP class called "ndfdXMLProxy.prg". Next I ran the following:

DO wconnect
DO ndfdxmlproxy.prg
o=CREATEOBJECT('ndfdxmlproxy')
cLatLon = o.latlonlistzipcode('90291') && target zip code for Venice California
? cLatLon

Which created the following XML:

<?xml version='1.0'?><dwml version='1.0' xmlns:xsd='<<span class="elements"><a href="http://www.w3.org/2001/XMLSchema" target="top" >http://www.w3.org/2001/XMLSchema<<span class="elements"></a>>' xmlns:xsi='<<span class="elements"><a href="http://www.w3.org/2001/XMLSchema-instance" target="top" >http://www.w3.org/2001/XMLSchema-instance<<span class="elements"></a>>' xsi:noNamespaceSchemaLocation='<<span class="elements"><a href="http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd" target="top" >http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd<<span class="elements"></a>>'><latLonList>33.9944,-118.464</latLonList></dwml>

The "latLonList" contains a coordinate pair for Santa Monica Airport which is the closest weather station to the desired zip code. It is my understanding this is how the weather service works, first you enter a zip code then they return the closest station. And then from there you enter the Latitude and Longitude of the station and make a second request for the parameters (temperature, wind, rain...) you are seeking to know about.

Here is a link that describes all of the possible Request types:

Request Types

And here is a link that let's you test the system:

Example Test Page

Now I need to figure out how to extract the XML "latLonList" as an object or a string before passing it back to the service for the weather forecast.

I think the next request call will be to the service described as:

VFP FUNCTION NDFDgen(...)

This function requires the following parameters:

FUNCTION NDFDgen(latitude as Decimal,longitude as Decimal,product as String,startTime as DateTime,endTime as DateTime,Unit as String,weatherParameters as weatherParametersType) as String

This is what the function looks like:

To understand the "weatherParameters" which relates back to what information the request should return, I've found the following documentation:

WeatherParameters

Now how to put it all together? <g> Maybe the missing Schema tat would allow the service to create an object was discovered (see my PS at the top of this post). Otherwise, I guess I'm wondering how to create a boiler plate object so wwXML.XMLToObject() will return a way to look at the XML results. Having to manually parse this data would be a real pain...!

Thanks




Rick Strahl
West Wind Technologies

Making waves on the Web
from Maui

Gravatar is a globally recognized avatar based on your email address. Re: National Weather Service forecast
  Rick Strahl
  Harvey Mushman
  May 30, 2015 @ 04:28pm
Ok took a look. WeatherParameters is an object.

So you create it with:

LOCAL loParms as ndfdXML.weatherParametersType
loParms = loBridge.CreateInstance("ndfdXML.weatherParametersType")
loParms.sky = .T.
loParms.temp = .T.
loParms.temp_r= .T.

loProxy.YourMethod(.., loParms, ...)


PS - I just discovered something else... (maybe this helps?)
?? Schema ??

Starting here.....


After downloading and installing West Wind Proxy Generator, I pointed the WSDL URL at the following address:

http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl

This generated a VFP class called "ndfdXMLProxy.prg". Next I ran the following:

DO wconnect
DO ndfdxmlproxy.prg
o=CREATEOBJECT('ndfdxmlproxy')
cLatLon = o.latlonlistzipcode('90291') && target zip code for Venice California
? cLatLon

Which created the following XML:

<?xml version='1.0'?><dwml version='1.0' xmlns:xsd='<<span class="elements"><a href="http://www.w3.org/2001/XMLSchema" target="top" >http://www.w3.org/2001/XMLSchema<<span class="elements"></a>>' xmlns:xsi='<<span class="elements"><a href="http://www.w3.org/2001/XMLSchema-instance" target="top" >http://www.w3.org/2001/XMLSchema-instance<<span class="elements"></a>>' xsi:noNamespaceSchemaLocation='<<span class="elements"><a href="http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd" target="top" >http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd<<span class="elements"></a>>'><latLonList>33.9944,-118.464</latLonList></dwml>

The "latLonList" contains a coordinate pair for Santa Monica Airport which is the closest weather station to the desired zip code. It is my understanding this is how the weather service works, first you enter a zip code then they return the closest station. And then from there you enter the Latitude and Longitude of the station and make a second request for the parameters (temperature, wind, rain...) you are seeking to know about.

Here is a link that describes all of the possible Request types:

Request Types

And here is a link that let's you test the system:

Example Test Page

Now I need to figure out how to extract the XML "latLonList" as an object or a string before passing it back to the service for the weather forecast.

I think the next request call will be to the service described as:

VFP FUNCTION NDFDgen(...)

This function requires the following parameters:

FUNCTION NDFDgen(latitude as Decimal,longitude as Decimal,product as String,startTime as DateTime,endTime as DateTime,Unit as String,weatherParameters as weatherParametersType) as String

This is what the function looks like:

To understand the "weatherParameters" which relates back to what information the request should return, I've found the following documentation:

WeatherParameters

Now how to put it all together? <g> Maybe the missing Schema tat would allow the service to create an object was discovered (see my PS at the top of this post). Otherwise, I guess I'm wondering how to create a boiler plate object so wwXML.XMLToObject() will return a way to look at the XML results. Having to manually parse this data would be a real pain...!

Thanks




Rick Strahl
West Wind Technologies

Making waves on the Web
from Maui

Gravatar is a globally recognized avatar based on your email address. Re: National Weather Service forecast
  Rick Strahl
  Harvey Mushman
  May 30, 2015 @ 05:00pm
Ok so here's how you do this:

CLEAR
DO wwUtils && for showxml()
DO ndfdXMLProxy

loProxy = CREATEOBJECT("ndfdXmlProxy")
lcLatLon = loProxy.latlonlistzipcode('96779')

lcLat = STREXTRACT(lcLatLon,"<latLonList>","</latLonList>")
lnlaItems = ALINES(laItems,lcLat,1,",")
lnLat = CAST(VAL(laItems[1]) as Y) && decimal
lnLon = CAST(VAL(laItems[2]) as Y) && decimal

? lcLatLon
? lnLat
? lnLon

*** create the enums
loUnitType = loProxy.oBridge.CreateComValue()
loUnitType.SetEnum("ndfdXML.unitType.e")

loProductType = loProxy.oBridge.CreateComValue()
loProductType.SetEnum("ndfdXML.productType.glance")

*** type structure
LOCAL loParms as ndfdXML.weatherParametersType
loParms = loProxy.oBridge.CreateInstance("ndfdXML.weatherParametersType")
loParms.sky = .T.
loParms.temp = .T.
loParms.temp_r= .T.

lcResult = loProxy.NDFDgen(lnLat,lnLon,loProductType,DATETIME() - 3600,DATETIME() + 600,loUnitType,loParms)

ShowXml( lcResult )
? loProxy.cErrorMsg

You're going to have to play around with the weather types I suppose to get what you want. Maybe set them all to .T. and see what you can get then pull out just what you need.

In my case the forecast was flat out wrong. It has a 50% chance of rain. We have only high clouds and there's no rain in the forecast here.

You can use wwXml to read values out of the result document pretty easily I think. I'm too lazy to work that out at this point though - it'll require some xpath to get the right stuff. The other issue is that the data will vary. I tried two different locations and I got quite different XML documents.

+++ RIck ---


PS - I just discovered something else... (maybe this helps?)
?? Schema ??

Starting here.....


After downloading and installing West Wind Proxy Generator, I pointed the WSDL URL at the following address:

http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl

This generated a VFP class called "ndfdXMLProxy.prg". Next I ran the following:

DO wconnect
DO ndfdxmlproxy.prg
o=CREATEOBJECT('ndfdxmlproxy')
cLatLon = o.latlonlistzipcode('90291') && target zip code for Venice California
? cLatLon

Which created the following XML:

<?xml version='1.0'?><dwml version='1.0' xmlns:xsd='<<span class="elements"><a href="http://www.w3.org/2001/XMLSchema" target="top" >http://www.w3.org/2001/XMLSchema<<span class="elements"></a>>' xmlns:xsi='<<span class="elements"><a href="http://www.w3.org/2001/XMLSchema-instance" target="top" >http://www.w3.org/2001/XMLSchema-instance<<span class="elements"></a>>' xsi:noNamespaceSchemaLocation='<<span class="elements"><a href="http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd" target="top" >http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd<<span class="elements"></a>>'><latLonList>33.9944,-118.464</latLonList></dwml>

The "latLonList" contains a coordinate pair for Santa Monica Airport which is the closest weather station to the desired zip code. It is my understanding this is how the weather service works, first you enter a zip code then they return the closest station. And then from there you enter the Latitude and Longitude of the station and make a second request for the parameters (temperature, wind, rain...) you are seeking to know about.

Here is a link that describes all of the possible Request types:

Request Types

And here is a link that let's you test the system:

Example Test Page

Now I need to figure out how to extract the XML "latLonList" as an object or a string before passing it back to the service for the weather forecast.

I think the next request call will be to the service described as:

VFP FUNCTION NDFDgen(...)

This function requires the following parameters:

FUNCTION NDFDgen(latitude as Decimal,longitude as Decimal,product as String,startTime as DateTime,endTime as DateTime,Unit as String,weatherParameters as weatherParametersType) as String

This is what the function looks like:

To understand the "weatherParameters" which relates back to what information the request should return, I've found the following documentation:

WeatherParameters

Now how to put it all together? <g> Maybe the missing Schema tat would allow the service to create an object was discovered (see my PS at the top of this post). Otherwise, I guess I'm wondering how to create a boiler plate object so wwXML.XMLToObject() will return a way to look at the XML results. Having to manually parse this data would be a real pain...!

Thanks




Rick Strahl
West Wind Technologies

Making waves on the Web
from Maui

Gravatar is a globally recognized avatar based on your email address. Re: National Weather Service forecast
  Harvey Mushman
  Rick Strahl
  May 31, 2015 @ 12:07pm
Copy and pasted your example below into PRG and ran it. I was able to pass in a zip code and return the LatLonList. When after that something is not connecting correctly.

loProxy.cErrorMsg = "product needs to be either time-series or glance.."

Not sure what is wrong or even where to start looking. I tried to step through the code but error message source is out of date shows up in the debugger. I'm assuming this is because the

--hm


Ok so here's how you do this:

CLEAR
DO wwUtils && for showxml()
DO ndfdXMLProxy

loProxy = CREATEOBJECT("ndfdXmlProxy")
lcLatLon = loProxy.latlonlistzipcode('96779')

lcLat = STREXTRACT(lcLatLon,"<latLonList>","</latLonList>")
lnlaItems = ALINES(laItems,lcLat,1,",")
lnLat = CAST(VAL(laItems[1]) as Y) && decimal
lnLon = CAST(VAL(laItems[2]) as Y) && decimal

? lcLatLon
? lnLat
? lnLon

*** create the enums
loUnitType = loProxy.oBridge.CreateComValue()
loUnitType.SetEnum("ndfdXML.unitType.e")

loProductType = loProxy.oBridge.CreateComValue()
loProductType.SetEnum("ndfdXML.productType.glance")

*** type structure
LOCAL loParms as ndfdXML.weatherParametersType
loParms = loProxy.oBridge.CreateInstance("ndfdXML.weatherParametersType")
loParms.sky = .T.
loParms.temp = .T.
loParms.temp_r= .T.

lcResult = loProxy.NDFDgen(lnLat,lnLon,loProductType,DATETIME() - 3600,DATETIME() + 600,loUnitType,loParms)

ShowXml( lcResult )
? loProxy.cErrorMsg

You're going to have to play around with the weather types I suppose to get what you want. Maybe set them all to .T. and see what you can get then pull out just what you need.

In my case the forecast was flat out wrong. It has a 50% chance of rain. We have only high clouds and there's no rain in the forecast here.

You can use wwXml to read values out of the result document pretty easily I think. I'm too lazy to work that out at this point though - it'll require some xpath to get the right stuff. The other issue is that the data will vary. I tried two different locations and I got quite different XML documents.

+++ RIck ---


PS - I just discovered something else... (maybe this helps?)
?? Schema ??

Starting here.....


After downloading and installing West Wind Proxy Generator, I pointed the WSDL URL at the following address:

http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl

This generated a VFP class called "ndfdXMLProxy.prg". Next I ran the following:

DO wconnect
DO ndfdxmlproxy.prg
o=CREATEOBJECT('ndfdxmlproxy')
cLatLon = o.latlonlistzipcode('90291') && target zip code for Venice California
? cLatLon

Which created the following XML:

<?xml version='1.0'?><dwml version='1.0' xmlns:xsd='<<span class="elements"><a href="http://www.w3.org/2001/XMLSchema" target="top" >http://www.w3.org/2001/XMLSchema<<span class="elements"></a>>' xmlns:xsi='<<span class="elements"><a href="http://www.w3.org/2001/XMLSchema-instance" target="top" >http://www.w3.org/2001/XMLSchema-instance<<span class="elements"></a>>' xsi:noNamespaceSchemaLocation='<<span class="elements"><a href="http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd" target="top" >http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd<<span class="elements"></a>>'><latLonList>33.9944,-118.464</latLonList></dwml>

The "latLonList" contains a coordinate pair for Santa Monica Airport which is the closest weather station to the desired zip code. It is my understanding this is how the weather service works, first you enter a zip code then they return the closest station. And then from there you enter the Latitude and Longitude of the station and make a second request for the parameters (temperature, wind, rain...) you are seeking to know about.

Here is a link that describes all of the possible Request types:

Request Types

And here is a link that let's you test the system:

Example Test Page

Now I need to figure out how to extract the XML "latLonList" as an object or a string before passing it back to the service for the weather forecast.

I think the next request call will be to the service described as:

VFP FUNCTION NDFDgen(...)

This function requires the following parameters:

FUNCTION NDFDgen(latitude as Decimal,longitude as Decimal,product as String,startTime as DateTime,endTime as DateTime,Unit as String,weatherParameters as weatherParametersType) as String

This is what the function looks like:

To understand the "weatherParameters" which relates back to what information the request should return, I've found the following documentation:

WeatherParameters

Now how to put it all together? <g> Maybe the missing Schema tat would allow the service to create an object was discovered (see my PS at the top of this post). Otherwise, I guess I'm wondering how to create a boiler plate object so wwXML.XMLToObject() will return a way to look at the XML results. Having to manually parse this data would be a real pain...!

Thanks





--hm--

Gravatar is a globally recognized avatar based on your email address. Re: National Weather Service forecast
  Harvey Mushman
  Rick Strahl
  Jun 2, 2015 @ 02:24am
Making a lot of progress...<g> But there is still a small problem that, I want to resolve with you before, I finish and go on to the next task, formatting the output.

The "productType" is allowed to be "time-series" or "glance" as defined by the service.

In the sample program you posted below this value is set as follows:

loProductType = loProxy.oBridge.CreateComValue()
loProductType.SetEnum("ndfdXML.productType.glance")

However, when I attempt to change the string to read:

loProductType.SetEnum("ndfdXML.productType.time-series")

I get an error message.

The service requires the value to be Time-Series before it will return a lot of the weather parameters, such as Wind information. Although I have not found any documentation to support this finding, I have found where they describe the "glance" mode to only provide a limited number of results. But after testing several times, I fairly sure my assumption is correct, I need to set the "time-series" mode.

I read your Help Topic "ComValue.SetEnum" and found something about overloading the call does not always work. I also found the following in the .WSDL file about the ProductType definition.

I also tried changing the way you called on setting the enum value as follows:

loProductType = loProxy.oBridge.CreateComValue()
loProductType.SetEnum("productType.time-series")

But I wonder why the above works, all I did was cut part of your string value "ndfdXML" which means it is no longer a valid setting?

So, I tried to just define ProductType without setting the value and found the service to return the desired results.

loProductType = loProxy.oBridge.CreateComValue()
*!* loProductType.SetEnum("productType.time-series")

My question is my fix actually only working by chance? It does not seem right to comment out and not set a value and have the service work correctly, unless setting the value is only an overload of the default value in the first place. (...and their documentation does not describe default values!)

What is the correct way to set the ProductType = time-series?

Thanks in advance for any guidance...

weatherParameter is probably an Enum.

You probably need to set the enum value like this and then pass the ComValue reference into the method:
wcdocs:_3ld0yy8uh.htm

At least the input API is strongly so, let the .NET proxy help you.

+++ Rick ---


PS - I just discovered something else... (maybe this helps?)
?? Schema ??

Starting here.....


After downloading and installing West Wind Proxy Generator, I pointed the WSDL URL at the following address:

http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl

This generated a VFP class called "ndfdXMLProxy.prg". Next I ran the following:

DO wconnect
DO ndfdxmlproxy.prg
o=CREATEOBJECT('ndfdxmlproxy')
cLatLon = o.latlonlistzipcode('90291') && target zip code for Venice California
? cLatLon

Which created the following XML:

<?xml version='1.0'?><dwml version='1.0' xmlns:xsd='<<span class="elements"><a href="http://www.w3.org/2001/XMLSchema" target="top" >http://www.w3.org/2001/XMLSchema<<span class="elements"></a>>' xmlns:xsi='<<span class="elements"><a href="http://www.w3.org/2001/XMLSchema-instance" target="top" >http://www.w3.org/2001/XMLSchema-instance<<span class="elements"></a>>' xsi:noNamespaceSchemaLocation='<<span class="elements"><a href="http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd" target="top" >http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd<<span class="elements"></a>>'><latLonList>33.9944,-118.464</latLonList></dwml>

The "latLonList" contains a coordinate pair for Santa Monica Airport which is the closest weather station to the desired zip code. It is my understanding this is how the weather service works, first you enter a zip code then they return the closest station. And then from there you enter the Latitude and Longitude of the station and make a second request for the parameters (temperature, wind, rain...) you are seeking to know about.

Here is a link that describes all of the possible Request types:

Request Types

And here is a link that let's you test the system:

Example Test Page

Now I need to figure out how to extract the XML "latLonList" as an object or a string before passing it back to the service for the weather forecast.

I think the next request call will be to the service described as:

VFP FUNCTION NDFDgen(...)

This function requires the following parameters:

FUNCTION NDFDgen(latitude as Decimal,longitude as Decimal,product as String,startTime as DateTime,endTime as DateTime,Unit as String,weatherParameters as weatherParametersType) as String

This is what the function looks like:

To understand the "weatherParameters" which relates back to what information the request should return, I've found the following documentation:

WeatherParameters

Now how to put it all together? <g> Maybe the missing Schema tat would allow the service to create an object was discovered (see my PS at the top of this post). Otherwise, I guess I'm wondering how to create a boiler plate object so wwXML.XMLToObject() will return a way to look at the XML results. Having to manually parse this data would be a real pain...!

Thanks





--hm--

Gravatar is a globally recognized avatar based on your email address. Re: National Weather Service forecast
  Rick Strahl
  Harvey Mushman
  Jun 2, 2015 @ 08:01am
Look in Reflector to see what the actual type name is. It has to match the enumeration value.

+++ Rick ---



Making a lot of progress...<g> But there is still a small problem that, I want to resolve with you before, I finish and go on to the next task, formatting the output.

The "productType" is allowed to be "time-series" or "glance" as defined by the service.

In the sample program you posted below this value is set as follows:

loProductType = loProxy.oBridge.CreateComValue()
loProductType.SetEnum("ndfdXML.productType.glance")

However, when I attempt to change the string to read:

loProductType.SetEnum("ndfdXML.productType.time-series")

I get an error message.

The service requires the value to be Time-Series before it will return a lot of the weather parameters, such as Wind information. Although I have not found any documentation to support this finding, I have found where they describe the "glance" mode to only provide a limited number of results. But after testing several times, I fairly sure my assumption is correct, I need to set the "time-series" mode.

I read your Help Topic "ComValue.SetEnum" and found something about overloading the call does not always work. I also found the following in the .WSDL file about the ProductType definition.

I also tried changing the way you called on setting the enum value as follows:

loProductType = loProxy.oBridge.CreateComValue()
loProductType.SetEnum("productType.time-series")

But I wonder why the above works, all I did was cut part of your string value "ndfdXML" which means it is no longer a valid setting?

So, I tried to just define ProductType without setting the value and found the service to return the desired results.

loProductType = loProxy.oBridge.CreateComValue()
*!* loProductType.SetEnum("productType.time-series")

My question is my fix actually only working by chance? It does not seem right to comment out and not set a value and have the service work correctly, unless setting the value is only an overload of the default value in the first place. (...and their documentation does not describe default values!)

What is the correct way to set the ProductType = time-series?

Thanks in advance for any guidance...

weatherParameter is probably an Enum.

You probably need to set the enum value like this and then pass the ComValue reference into the method:
wcdocs:_3ld0yy8uh.htm

At least the input API is strongly so, let the .NET proxy help you.

+++ Rick ---


PS - I just discovered something else... (maybe this helps?)
?? Schema ??

Starting here.....


After downloading and installing West Wind Proxy Generator, I pointed the WSDL URL at the following address:

http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl

This generated a VFP class called "ndfdXMLProxy.prg". Next I ran the following:

DO wconnect
DO ndfdxmlproxy.prg
o=CREATEOBJECT('ndfdxmlproxy')
cLatLon = o.latlonlistzipcode('90291') && target zip code for Venice California
? cLatLon

Which created the following XML:

<?xml version='1.0'?><dwml version='1.0' xmlns:xsd='<<span class="elements"><a href="http://www.w3.org/2001/XMLSchema" target="top" >http://www.w3.org/2001/XMLSchema<<span class="elements"></a>>' xmlns:xsi='<<span class="elements"><a href="http://www.w3.org/2001/XMLSchema-instance" target="top" >http://www.w3.org/2001/XMLSchema-instance<<span class="elements"></a>>' xsi:noNamespaceSchemaLocation='<<span class="elements"><a href="http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd" target="top" >http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd<<span class="elements"></a>>'><latLonList>33.9944,-118.464</latLonList></dwml>

The "latLonList" contains a coordinate pair for Santa Monica Airport which is the closest weather station to the desired zip code. It is my understanding this is how the weather service works, first you enter a zip code then they return the closest station. And then from there you enter the Latitude and Longitude of the station and make a second request for the parameters (temperature, wind, rain...) you are seeking to know about.

Here is a link that describes all of the possible Request types:

Request Types

And here is a link that let's you test the system:

Example Test Page

Now I need to figure out how to extract the XML "latLonList" as an object or a string before passing it back to the service for the weather forecast.

I think the next request call will be to the service described as:

VFP FUNCTION NDFDgen(...)

This function requires the following parameters:

FUNCTION NDFDgen(latitude as Decimal,longitude as Decimal,product as String,startTime as DateTime,endTime as DateTime,Unit as String,weatherParameters as weatherParametersType) as String

This is what the function looks like:

To understand the "weatherParameters" which relates back to what information the request should return, I've found the following documentation:

WeatherParameters

Now how to put it all together? <g> Maybe the missing Schema tat would allow the service to create an object was discovered (see my PS at the top of this post). Otherwise, I guess I'm wondering how to create a boiler plate object so wwXML.XMLToObject() will return a way to look at the XML results. Having to manually parse this data would be a real pain...!

Thanks







Rick Strahl
West Wind Technologies

Making waves on the Web
from Maui

Gravatar is a globally recognized avatar based on your email address. Re: National Weather Service forecast
  Harvey Mushman
  Rick Strahl
  Jun 4, 2015 @ 06:53pm
Parsing this XML tree is such a bitch - it is torturing... <g> :-(

But I'll get it, just wait and see!



Look in Reflector to see what the actual type name is. It has to match the enumeration value.

+++ Rick ---



Making a lot of progress...<g> But there is still a small problem that, I want to resolve with you before, I finish and go on to the next task, formatting the output.

The "productType" is allowed to be "time-series" or "glance" as defined by the service.

In the sample program you posted below this value is set as follows:

loProductType = loProxy.oBridge.CreateComValue()
loProductType.SetEnum("ndfdXML.productType.glance")

However, when I attempt to change the string to read:

loProductType.SetEnum("ndfdXML.productType.time-series")

I get an error message.

The service requires the value to be Time-Series before it will return a lot of the weather parameters, such as Wind information. Although I have not found any documentation to support this finding, I have found where they describe the "glance" mode to only provide a limited number of results. But after testing several times, I fairly sure my assumption is correct, I need to set the "time-series" mode.

I read your Help Topic "ComValue.SetEnum" and found something about overloading the call does not always work. I also found the following in the .WSDL file about the ProductType definition.

I also tried changing the way you called on setting the enum value as follows:

loProductType = loProxy.oBridge.CreateComValue()
loProductType.SetEnum("productType.time-series")

But I wonder why the above works, all I did was cut part of your string value "ndfdXML" which means it is no longer a valid setting?

So, I tried to just define ProductType without setting the value and found the service to return the desired results.

loProductType = loProxy.oBridge.CreateComValue()
*!* loProductType.SetEnum("productType.time-series")

My question is my fix actually only working by chance? It does not seem right to comment out and not set a value and have the service work correctly, unless setting the value is only an overload of the default value in the first place. (...and their documentation does not describe default values!)

What is the correct way to set the ProductType = time-series?

Thanks in advance for any guidance...

weatherParameter is probably an Enum.

You probably need to set the enum value like this and then pass the ComValue reference into the method:
wcdocs:_3ld0yy8uh.htm

At least the input API is strongly so, let the .NET proxy help you.

+++ Rick ---


PS - I just discovered something else... (maybe this helps?)
?? Schema ??

Starting here.....


After downloading and installing West Wind Proxy Generator, I pointed the WSDL URL at the following address:

http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl

This generated a VFP class called "ndfdXMLProxy.prg". Next I ran the following:

DO wconnect
DO ndfdxmlproxy.prg
o=CREATEOBJECT('ndfdxmlproxy')
cLatLon = o.latlonlistzipcode('90291') && target zip code for Venice California
? cLatLon

Which created the following XML:

<?xml version='1.0'?><dwml version='1.0' xmlns:xsd='<<span class="elements"><a href="http://www.w3.org/2001/XMLSchema" target="top" >http://www.w3.org/2001/XMLSchema<<span class="elements"></a>>' xmlns:xsi='<<span class="elements"><a href="http://www.w3.org/2001/XMLSchema-instance" target="top" >http://www.w3.org/2001/XMLSchema-instance<<span class="elements"></a>>' xsi:noNamespaceSchemaLocation='<<span class="elements"><a href="http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd" target="top" >http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd<<span class="elements"></a>>'><latLonList>33.9944,-118.464</latLonList></dwml>

The "latLonList" contains a coordinate pair for Santa Monica Airport which is the closest weather station to the desired zip code. It is my understanding this is how the weather service works, first you enter a zip code then they return the closest station. And then from there you enter the Latitude and Longitude of the station and make a second request for the parameters (temperature, wind, rain...) you are seeking to know about.

Here is a link that describes all of the possible Request types:

Request Types

And here is a link that let's you test the system:

Example Test Page

Now I need to figure out how to extract the XML "latLonList" as an object or a string before passing it back to the service for the weather forecast.

I think the next request call will be to the service described as:

VFP FUNCTION NDFDgen(...)

This function requires the following parameters:

FUNCTION NDFDgen(latitude as Decimal,longitude as Decimal,product as String,startTime as DateTime,endTime as DateTime,Unit as String,weatherParameters as weatherParametersType) as String

This is what the function looks like:

To understand the "weatherParameters" which relates back to what information the request should return, I've found the following documentation:

WeatherParameters

Now how to put it all together? <g> Maybe the missing Schema tat would allow the service to create an object was discovered (see my PS at the top of this post). Otherwise, I guess I'm wondering how to create a boiler plate object so wwXML.XMLToObject() will return a way to look at the XML results. Having to manually parse this data would be a real pain...!

Thanks








--hm--

Gravatar is a globally recognized avatar based on your email address. Re: National Weather Service forecast
  Harvey Mushman
  Harvey Mushman
  Jun 4, 2015 @ 08:26pm
The sample code below is now able to parse the WSDL result you posted a few days ago.

As Boris Grishenko (Áîðèñ Ãðèùåíêî) the Russian computer technician put it in the 007 GoldenEye movie I'm Invincible ... it just took three days to figure it out! <s>

Thanks for your help!!!


DEBUG
CLEAR
wwXML = CREATEOBJECT('wwXML')
lcResult = FILETOSTR('c:\wconnect\XMLSample.xml')
wwXML.LoadXML(lcResult)
loXML = wwXML.oXML

loChildNodes = loXML.ChildNodes
lcChildNodes = 'loXML.ChildNodes'
llParse = .t.
DO WHILE llParse
FOR lnNode = 0 TO loChildNodes.Length -1
loNode = loChildNodes.Item(lnNode)
IF NOT ISNULL(loNode)
? loNode.BaseName +' '+ TRANSFORM(loNode.NodeValue)

IF NOT ISNULL(loNode.Attributes)
FOR EACH loAttribute IN loNode.Attributes
? loAttribute.NodeName +' '+ TRANSFORM(loAttribute.NodeValue)
ENDFOR
?
ENDIF
ENDIF
ENDFOR
IF loNode.hasChildNodes
lcChildNodes = lcChildNodes + '.Item(' + TRANSFORM(loChildNodes.Length -1) + ').ChildNodes'
ELSE
* reduce last items -1
DO WHILE GETWORDCOUNT(lcChildNodes,'.') > 2
lcItem = GETWORDNUM(lcChildNodes,GETWORDCOUNT(lcChildNodes,'.')-1,'.')
lnItemValue = VAL( SUBSTR(lcItem,6,LEN(lcItem)-6) )
lcNewItem = '.Item(' +TRANSFORM( lnItemValue -1) + ')'
lcBase = SUBSTR(lcChildNodes,1,RAT('Item(',lcChildNodes,1) -2)
lcChildNodes = lcBase + lcNewItem + '.ChildNodes'
IF lnItemValue -1 < 0
* strip off lcBase and lcNewItem, repeate up one branch
lcChildNodes = SUBSTR(lcChildNodes,1,RAT('.Item(',lcChildNodes,1))
LOOP
ELSE
EXIT
ENDIF
ENDDO
IF GETWORDCOUNT(lcChildNodes,'.') <= 2
* all done
EXIT
ENDIF
ENDIF
* ? lcChildNodes
loChildNodes = &lcChildNodes
ENDDO



Parsing this XML tree is such a bitch - it is torturing... <g> :-(

But I'll get it, just wait and see!



Look in Reflector to see what the actual type name is. It has to match the enumeration value.

+++ Rick ---



Making a lot of progress...<g> But there is still a small problem that, I want to resolve with you before, I finish and go on to the next task, formatting the output.

The "productType" is allowed to be "time-series" or "glance" as defined by the service.

In the sample program you posted below this value is set as follows:

loProductType = loProxy.oBridge.CreateComValue()
loProductType.SetEnum("ndfdXML.productType.glance")

However, when I attempt to change the string to read:

loProductType.SetEnum("ndfdXML.productType.time-series")

I get an error message.

The service requires the value to be Time-Series before it will return a lot of the weather parameters, such as Wind information. Although I have not found any documentation to support this finding, I have found where they describe the "glance" mode to only provide a limited number of results. But after testing several times, I fairly sure my assumption is correct, I need to set the "time-series" mode.

I read your Help Topic "ComValue.SetEnum" and found something about overloading the call does not always work. I also found the following in the .WSDL file about the ProductType definition.

I also tried changing the way you called on setting the enum value as follows:

loProductType = loProxy.oBridge.CreateComValue()
loProductType.SetEnum("productType.time-series")

But I wonder why the above works, all I did was cut part of your string value "ndfdXML" which means it is no longer a valid setting?

So, I tried to just define ProductType without setting the value and found the service to return the desired results.

loProductType = loProxy.oBridge.CreateComValue()
*!* loProductType.SetEnum("productType.time-series")

My question is my fix actually only working by chance? It does not seem right to comment out and not set a value and have the service work correctly, unless setting the value is only an overload of the default value in the first place. (...and their documentation does not describe default values!)

What is the correct way to set the ProductType = time-series?

Thanks in advance for any guidance...

weatherParameter is probably an Enum.

You probably need to set the enum value like this and then pass the ComValue reference into the method:
wcdocs:_3ld0yy8uh.htm

At least the input API is strongly so, let the .NET proxy help you.

+++ Rick ---


PS - I just discovered something else... (maybe this helps?)
?? Schema ??

Starting here.....


After downloading and installing West Wind Proxy Generator, I pointed the WSDL URL at the following address:

http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl

This generated a VFP class called "ndfdXMLProxy.prg". Next I ran the following:

DO wconnect
DO ndfdxmlproxy.prg
o=CREATEOBJECT('ndfdxmlproxy')
cLatLon = o.latlonlistzipcode('90291') && target zip code for Venice California
? cLatLon

Which created the following XML:

<?xml version='1.0'?><dwml version='1.0' xmlns:xsd='<<span class="elements"><a href="http://www.w3.org/2001/XMLSchema" target="top" >http://www.w3.org/2001/XMLSchema<<span class="elements"></a>>' xmlns:xsi='<<span class="elements"><a href="http://www.w3.org/2001/XMLSchema-instance" target="top" >http://www.w3.org/2001/XMLSchema-instance<<span class="elements"></a>>' xsi:noNamespaceSchemaLocation='<<span class="elements"><a href="http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd" target="top" >http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd<<span class="elements"></a>>'><latLonList>33.9944,-118.464</latLonList></dwml>

The "latLonList" contains a coordinate pair for Santa Monica Airport which is the closest weather station to the desired zip code. It is my understanding this is how the weather service works, first you enter a zip code then they return the closest station. And then from there you enter the Latitude and Longitude of the station and make a second request for the parameters (temperature, wind, rain...) you are seeking to know about.

Here is a link that describes all of the possible Request types:

Request Types

And here is a link that let's you test the system:

Example Test Page

Now I need to figure out how to extract the XML "latLonList" as an object or a string before passing it back to the service for the weather forecast.

I think the next request call will be to the service described as:

VFP FUNCTION NDFDgen(...)

This function requires the following parameters:

FUNCTION NDFDgen(latitude as Decimal,longitude as Decimal,product as String,startTime as DateTime,endTime as DateTime,Unit as String,weatherParameters as weatherParametersType) as String

This is what the function looks like:

To understand the "weatherParameters" which relates back to what information the request should return, I've found the following documentation:

WeatherParameters

Now how to put it all together? <g> Maybe the missing Schema tat would allow the service to create an object was discovered (see my PS at the top of this post). Otherwise, I guess I'm wondering how to create a boiler plate object so wwXML.XMLToObject() will return a way to look at the XML results. Having to manually parse this data would be a real pain...!

Thanks








Gravatar is a globally recognized avatar based on your email address. Re: National Weather Service forecast
  Rick Strahl
  Harvey Mushman
  Jun 5, 2015 @ 08:10am

XPATH makes that much easier. Using SelectSingleNode() or SelectNodes() lets you directly jump to the right nodes. wwXML has some helper methods for this as well.

+++ Rick ---



The sample code below is now able to parse the WSDL result you posted a few days ago.

As Boris Grishenko (Áîðèñ Ãðèùåíêî) the Russian computer technician put it in the 007 GoldenEye movie I'm Invincible ... it just took three days to figure it out! <s>

Thanks for your help!!!


DEBUG
CLEAR
wwXML = CREATEOBJECT('wwXML')
lcResult = FILETOSTR('c:\wconnect\XMLSample.xml')
wwXML.LoadXML(lcResult)
loXML = wwXML.oXML

loChildNodes = loXML.ChildNodes
lcChildNodes = 'loXML.ChildNodes'
llParse = .t.
DO WHILE llParse
FOR lnNode = 0 TO loChildNodes.Length -1
loNode = loChildNodes.Item(lnNode)
IF NOT ISNULL(loNode)
? loNode.BaseName +' '+ TRANSFORM(loNode.NodeValue)

IF NOT ISNULL(loNode.Attributes)
FOR EACH loAttribute IN loNode.Attributes
? loAttribute.NodeName +' '+ TRANSFORM(loAttribute.NodeValue)
ENDFOR
?
ENDIF
ENDIF
ENDFOR
IF loNode.hasChildNodes
lcChildNodes = lcChildNodes + '.Item(' + TRANSFORM(loChildNodes.Length -1) + ').ChildNodes'
ELSE
* reduce last items -1
DO WHILE GETWORDCOUNT(lcChildNodes,'.') > 2
lcItem = GETWORDNUM(lcChildNodes,GETWORDCOUNT(lcChildNodes,'.')-1,'.')
lnItemValue = VAL( SUBSTR(lcItem,6,LEN(lcItem)-6) )
lcNewItem = '.Item(' +TRANSFORM( lnItemValue -1) + ')'
lcBase = SUBSTR(lcChildNodes,1,RAT('Item(',lcChildNodes,1) -2)
lcChildNodes = lcBase + lcNewItem + '.ChildNodes'
IF lnItemValue -1 < 0
* strip off lcBase and lcNewItem, repeate up one branch
lcChildNodes = SUBSTR(lcChildNodes,1,RAT('.Item(',lcChildNodes,1))
LOOP
ELSE
EXIT
ENDIF
ENDDO
IF GETWORDCOUNT(lcChildNodes,'.') <= 2
* all done
EXIT
ENDIF
ENDIF
* ? lcChildNodes
loChildNodes = &lcChildNodes
ENDDO



Parsing this XML tree is such a bitch - it is torturing... <g> :-(

But I'll get it, just wait and see!



Look in Reflector to see what the actual type name is. It has to match the enumeration value.

+++ Rick ---



Making a lot of progress...<g> But there is still a small problem that, I want to resolve with you before, I finish and go on to the next task, formatting the output.

The "productType" is allowed to be "time-series" or "glance" as defined by the service.

In the sample program you posted below this value is set as follows:

loProductType = loProxy.oBridge.CreateComValue()
loProductType.SetEnum("ndfdXML.productType.glance")

However, when I attempt to change the string to read:

loProductType.SetEnum("ndfdXML.productType.time-series")

I get an error message.

The service requires the value to be Time-Series before it will return a lot of the weather parameters, such as Wind information. Although I have not found any documentation to support this finding, I have found where they describe the "glance" mode to only provide a limited number of results. But after testing several times, I fairly sure my assumption is correct, I need to set the "time-series" mode.

I read your Help Topic "ComValue.SetEnum" and found something about overloading the call does not always work. I also found the following in the .WSDL file about the ProductType definition.

I also tried changing the way you called on setting the enum value as follows:

loProductType = loProxy.oBridge.CreateComValue()
loProductType.SetEnum("productType.time-series")

But I wonder why the above works, all I did was cut part of your string value "ndfdXML" which means it is no longer a valid setting?

So, I tried to just define ProductType without setting the value and found the service to return the desired results.

loProductType = loProxy.oBridge.CreateComValue()
*!* loProductType.SetEnum("productType.time-series")

My question is my fix actually only working by chance? It does not seem right to comment out and not set a value and have the service work correctly, unless setting the value is only an overload of the default value in the first place. (...and their documentation does not describe default values!)

What is the correct way to set the ProductType = time-series?

Thanks in advance for any guidance...

weatherParameter is probably an Enum.

You probably need to set the enum value like this and then pass the ComValue reference into the method:
wcdocs:_3ld0yy8uh.htm

At least the input API is strongly so, let the .NET proxy help you.

+++ Rick ---


PS - I just discovered something else... (maybe this helps?)
?? Schema ??

Starting here.....


After downloading and installing West Wind Proxy Generator, I pointed the WSDL URL at the following address:

http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl

This generated a VFP class called "ndfdXMLProxy.prg". Next I ran the following:

DO wconnect
DO ndfdxmlproxy.prg
o=CREATEOBJECT('ndfdxmlproxy')
cLatLon = o.latlonlistzipcode('90291') && target zip code for Venice California
? cLatLon

Which created the following XML:

<?xml version='1.0'?><dwml version='1.0' xmlns:xsd='<<span class="elements"><a href="http://www.w3.org/2001/XMLSchema" target="top" >http://www.w3.org/2001/XMLSchema<<span class="elements"></a>>' xmlns:xsi='<<span class="elements"><a href="http://www.w3.org/2001/XMLSchema-instance" target="top" >http://www.w3.org/2001/XMLSchema-instance<<span class="elements"></a>>' xsi:noNamespaceSchemaLocation='<<span class="elements"><a href="http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd" target="top" >http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd<<span class="elements"></a>>'><latLonList>33.9944,-118.464</latLonList></dwml>

The "latLonList" contains a coordinate pair for Santa Monica Airport which is the closest weather station to the desired zip code. It is my understanding this is how the weather service works, first you enter a zip code then they return the closest station. And then from there you enter the Latitude and Longitude of the station and make a second request for the parameters (temperature, wind, rain...) you are seeking to know about.

Here is a link that describes all of the possible Request types:

Request Types

And here is a link that let's you test the system:

Example Test Page

Now I need to figure out how to extract the XML "latLonList" as an object or a string before passing it back to the service for the weather forecast.

I think the next request call will be to the service described as:

VFP FUNCTION NDFDgen(...)

This function requires the following parameters:

FUNCTION NDFDgen(latitude as Decimal,longitude as Decimal,product as String,startTime as DateTime,endTime as DateTime,Unit as String,weatherParameters as weatherParametersType) as String

This is what the function looks like:

To understand the "weatherParameters" which relates back to what information the request should return, I've found the following documentation:

WeatherParameters

Now how to put it all together? <g> Maybe the missing Schema tat would allow the service to create an object was discovered (see my PS at the top of this post). Otherwise, I guess I'm wondering how to create a boiler plate object so wwXML.XMLToObject() will return a way to look at the XML results. Having to manually parse this data would be a real pain...!

Thanks











Rick Strahl
West Wind Technologies

Making waves on the Web
from Maui

© 1996-2024