Hi,
We tried with CityWeather Webservice example given in Introducing .NET by
Wrox Press. We have created CityWeather and TestCityWeather applications in
wwwroot. While running Webservice it gives the error:
System.Net.WebException: The system was unable to submit the request: The
remote name could not be resolved.
at System.Net.HttpWebRequest.CheckFinalStatus()
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult AsyncResult)
at System.Net.HttpWebRequest.GetResponse()
at CityWeather.CityWeather.GetWeather(String strZipCode) in
c:\inetpub\wwwroot\CityWeather\CityWeather.vb:line 59
Machine which has Webservice is connected to Internet through Proxy. But if
intranet address (our intranet web) is given for URI, it works fine. We
tested the URL "http://weather.searchwho.com/cgi-bin/myweather.pl" in the
Browser directly and it returns the weather details. Suggestions and
Solutions would be appreciated.
GetWeather Web Method:
Public Function <WebMethod()> GetWeather(ByVal strZipCode As String) _
As String
' -- Declare variables
Dim strResult As String ' Our result
Dim strHTML As String ' The HTML we expect back
Dim strURI As String ' The URL/URI we are going to hit
Dim objWRQ As System.Net.WebRequest ' The Request object
Dim objWRS As System.Net.WebResponse ' The Response object
Dim objWRF As System.Net.WebRequestFactory ' The Request object
creator
Dim objStream As System.IO.StreamReader ' The stream of data coming
back
' -- SearchWho.com URL to access
Const WEATHER_URI As String
"http://weather.searchwho.com/cgi-bin/myweather.pl"
' -- 1. Build our URL using the Zip code sent in
strURI = WEATHER_URI & "?loc=" & strZipCode
' -- 2. Create a Request object based on our URI,
'and call the remote server
objWRQ = objWRF.Create(strURI)
' -- 3. Get the response back from the remote server
objWRS = objWRQ.GetResponse() ----> error occurs here
' -- 4. Read the response into a String format
objStream = New System.IO.StreamReader(objWrs.GetResponseStream(), _
System.Text.Encoding.ASCII)
....................
....................
....................
End Function
Regards,
- Vijay