以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  关于调用webservice的问题  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=59263)

--  作者:jialihaha
--  发布时间:2014/10/31 17:05:00
--  关于调用webservice的问题
现在我给出一段代码:
Dim rqst As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("http://www.webxml.com.cn/WebServices/WeatherWebService.asmx/getWeatherbyCityName?theCityName=59316")
Dim rsps As System.Net.HttpWebResponse = rqst.GetResponse
Dim stm As System.IO.Stream = rsps.GetResponseStream()
rsps = Nothing
rqst = Nothing
Dim reader As New System.IO.StreamReader(stm)
Dim strXML As String = reader.ReadToEnd
stm.Dispose()

在命令窗口执行,500报错,求大神指导,是什么原因导致的,网址是可以打开的,也可以看到xml的内容

--  作者:有点甜
--  发布时间:2014/10/31 17:06:00
--  

 不要www

 

Dim rqst As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("http://webxml.com.cn/WebServices/WeatherWebService.asmx/getWeatherbyCityName?theCityName=59316")
Dim rsps As System.Net.HttpWebResponse = rqst.GetResponse
Dim stm As System.IO.Stream = rsps.GetResponseStream()
rsps = Nothing
rqst = Nothing
Dim reader As New System.IO.StreamReader(stm)
Dim strXML As String = reader.ReadToEnd
stm.Dispose()

--  作者:jialihaha
--  发布时间:2014/10/31 17:07:00
--  
什么意思?
--  作者:jialihaha
--  发布时间:2014/10/31 17:11:00
--  
不行哈,这样得不到要的结果
--  作者:jialihaha
--  发布时间:2014/10/31 17:18:00
--  
求指导
--  作者:有点甜
--  发布时间:2014/10/31 17:25:00
--  

 换种方法

 

Dim web As New System.Windows.Forms.WebBrowser()
web.ScriptErrorsSuppressed = True
web.Navigate("http://www.webxml.com.cn/WebServices/WeatherWebService.asmx/getWeatherbyCityName?theCityName=59316")
 
Do Until web.ReadyState = 4
    Application.DoEvents
Loop

output.show(web.Document.Body.InnerText)


--  作者:jialihaha
--  发布时间:2014/10/31 17:35:00
--  
搞不定,给你项目帮我弄弄吧,ok?
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:天气预报.zip


--  作者:有点甜
--  发布时间:2014/10/31 17:48:00
--  
    
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:天气预报.rar