|
-
Jun 28th, 2006, 09:04 AM
#1
Thread Starter
Hyperactive Member
[2005] Problem Consuming SOAP Web Service in my VB app
I am trying to use this NOAA webservice in my VB 2005 application.
http://www.nws.noaa.gov/forecasts/xml/
I am using this server function
You can view an example of how to invoke NDFDgenByDay() in the following web page and the SOAP client it uses.
http://www.weather.gov/forecasts/xml...dSOAPByDay.htm
And my code looks like this:
VB Code:
Try
Dim decLat As Decimal = CDec(38.99)
Dim decLon As Decimal = CDec(-77.99)
Dim dtDate As Date = CDate("2006-06-28")
Dim strDays As String = "5"
Dim myWebService As New gov.weather.[url]www.ndfdXML[/url]
myWebService.NDFDgenByDay( _
decLat, _
decLon, _
dtDate, _
strDays, _
gov.weather.[url]www.formatType.Item12hourly[/url])
Catch ex As Exception
MessageBox.Show( _
ex.Message & vbNewLine & _
ex.Source & vbNewLine & _
ex.StackTrace, _
"Web Service Error", _
MessageBoxButtons.OK, _
MessageBoxIcon.Error)
End Try
I am getting this error:
---------------------------
Web Service Error
---------------------------
The server committed a protocol violation. Section=ResponseStatusLine
System.Web.Services
at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)
at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at NOAA_Weather.gov.weather.www.ndfdXML.NDFDgenByDay(Decimal latitude, Decimal longitude, DateTime startDate, String numDays, formatType format) in C:\NOAA\NOAA_Weather\NOAA_Weather\Web References\gov.weather.www\Reference.vb:line 112
at NOAA_Weather.Form1.btnGetWeather_Click(Object sender, EventArgs e) in C:\NOAA\NOAA_Weather\NOAA_Weather\Form1.vb:line 13
Anybody see anything that obviously wrong.
-
Jul 3rd, 2006, 03:14 PM
#2
Thread Starter
Hyperactive Member
RE: [2005] Problem Consuming SOAP Web Service in my VB app
Fixed with the help of this link. Basicaly you need to force HTTP/1.0 protocol which prevents the server from using chunked encoding.
The VB Code to do so is
VB Code:
Protected Overrides Function GetWebRequest(ByVal uri As Uri) As WebRequest
'Quick & Dirty NOAA Weather hack added to the wsdl generated file
Dim request As HttpWebRequest = CType(MyBase.GetWebRequest(uri), HttpWebRequest)
request.ProtocolVersion = HttpVersion.Version10
Return request
End Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|