nws网络服务问题

nws网络服务问题

问题描述:

你好,

我在尝试从国家气象局获取天气预报时遇到问题.

我正在使用VS2010.新的控制台应用程序并添加了http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl并将其重命名为gov.weather

这是我的代码

Hello,

I am having an issue trying to get the weather predictions from National Weather Services.

I am using VS2010. New console application and added http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl and renamed it to gov.weather

This is my code

Dim weather As ndfdXMLPortTypeClient = New ndfdXMLPortTypeClient()
Dim soapWeatherParameters As weatherParametersType = New weatherParametersType()

weather.NDFDgen(42.73, -73.99, "time-series", Now, Now.AddDays(5), soapWeatherParameters)



我遇到一个错误,指出从字符串时间序列"到类型"Integer"的转换无效."



I have an error stating "Conversion from string "time-series" to type ''Integer'' is not valid."

产品类型是其自己的类,而不是字符串.

更改您的代码,使其看起来像这样,我认为它应该可以工作.我在VS2008中检查了代码,但我想它在VS2010中类似.

The product type is its own class, not a string.

Change your code to look like this and I believe it should work. I checked the code in VS2008, but I would imagine it''s similar in VS2010.

Dim weather As ndfdXMLPortTypeClient = New ndfdXMLPortTypeClient()
Dim soapWeatherParameters As weatherParametersType = New weatherParametersType()

weather.NDFDgen(42.73, -73.99, productType.timeseries, Now, Now.AddDays(5), soapWeatherParameters)