USING WEBSERVICE

  • Thread starter Thread starter Tommy
  • Start date Start date
T

Tommy

hello,

i try´d to use an webservice like
Global Weather http://www.webservicex.net/globalweather.asmx?WSDL

i have add a reference to my asp.net-website and write the follwing
code(button1_click)

Dim ProxyWeather As New Weather.GlobalWeather()

Label1.Text = ProxyWeather.GetWeather("munich", "germany")



and i get an error, "connection is refused and closed"



what i am doing wrong??? any suggestions?



best regards



tommy
 
Add a reference to the webservice to your project and rename it
GlobalWeatherSvc

Add a button and a label named lblResult

The following code should do the trick. It produced a weather report for
me.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim MyWeather As New GlobalWeatherSvc.GlobalWeather
Dim Results As IAsyncResult = MyWeather.BeginGetWeather("Munich",
"Germany", Nothing, Nothing)
Dim Result As String
Result = MyWeather.EndGetWeather(Results)
Me.lblResult.Text = Result
End Sub
 
hello william,

thanks for reply....

i changed my code like yours... but the failure is the same

The underlying connection was closed: The connection with the remote
server cannot be made.


maybe i have to fix some security-reasons???
any suggestion?

best regards

tommy

----------------------------------------
HangulHanjaFastConversion-Eigenschaft

True if Microsoft Word automatically converts a word with
only one suggestion during conversion between hangul
and hanja. Read/write Boolean.
 
did you check your http proxy setting?
Some companies or organizations require outgoing connections to be made
through a proxy server.

[One indication that this is the case for you is if IE has a proxy server
setting. Within IE:
Tools > Internet Options > Connections > LAN Settings

....check to see if the proxy server is checked.

If so then you probably need to set a proxy server on the webservice client
proxy. ]

Note, here I am using proxy to refer to 2 distinct entities. The
webservice client proxy in your code is called ProxyWeather. The other
proxy is a network proxy server; I am suggesting one may be in use on your
network.

In your app, something like

Dim ProxyWeather As New Weather.GlobalWeather()
ProxyWeather.Proxy= New WebProxy("http://MyProxyServer:80", true)

....where MyProxyServer is the thing used by IE (above), or otherwise
communicated to you by your network admin.

-D
 
DINO!!!!!

YOU ARE REALLY GOOD!!

THATS IT!

NOW IT WORKS FINE!!

Thank You Very Much

Best Regard


Tommy

----------------------------------------
HangulHanjaFastConversion-Eigenschaft

True if Microsoft Word automatically converts a word with
only one suggestion during conversion between hangul
and hanja. Read/write Boolean.
 
Back
Top