|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Asp.net Webservice simple question
Hi,
I am new to webservices. I am trying to invoke a webservice in Asp.net. The information about the webservice can be found at http://hurricane.terrapin.com/soap_access.html.en I have added http://weather.terrapin.com/soap/HurricaneService.wsdl to my webreferences successfully. In my code I try to invoke getCurrentStorms method and it gives me error. My code reads like: ************************************************** ************************************************** ************************************************** ************* Private Sub btnGetStormNames_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGetStormNames.Click Dim aw1 As com.terrapin.weather.HurricaneServiceService = New com.terrapin.weather.HurricaneServiceService Dim ws1 As com.terrapin.weather.StormResult() = aw1.getCurrentStorms Dim stormRes As New com.terrapin.weather.StormResult With lbStormNames.Items For Each stormRes In ws1 .Add(stormRes.stormCode) Next End With End Sub ************************************************** ************************************************** ************************************************** ************* When my code reaches the "Dim ws1 As com.terrapin.weather.StormResult() = aw1.getCurrentStorms" line, it fails with the following message: ************************************************** ************************************************** ************************************************** ************* The specified type was not recognized: name='StormResult', namespace='urn:HurricaneService', at <return xmlns=''>. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidOperationException: The specified type was not recognized: name='StormResult', namespace='urn:HurricaneService', at <return xmlns=''>. Source Error: Line 42: <System.Web.Services.Protocols.SoapRpcMethodAttribu te("", RequestNamespace:="urn:HurricaneService", ResponseNamespace:="urn:HurricaneService")> _ Line 43: Public Function getCurrentStorms() As <System.Xml.Serialization.SoapElementAttribute("getCurrentStormsReturn")> StormResult() Line 44: Dim results() As Object = Me.Invoke("getCurrentStorms", New Object(-1) {}) Line 45: Return CType(results(0),StormResult()) Line 46: End Function Source File: c:\inetpub\wwwroot\HurricaneTracker\Web References\com.terrapin.weather\Reference.vb Line: 44 Stack Trace: [InvalidOperationException: The specified type was not recognized: name='StormResult', namespace='urn:HurricaneService', at <return xmlns=''>.] System.Xml.Serialization.XmlSerializationReader.Ge tPrimitiveType(XmlQualifiedName typeName, Boolean throwOnUnknown) System.Xml.Serialization.XmlSerializationReader.Re adArray(String typeName, String typeNs) System.Xml.Serialization.XmlSerializationReader.Re adReferencingElement(String name, String ns, Boolean elementCanBeType, String& fixupReference) System.Xml.Serialization.XmlSerializationReader.Re adReferencingElement(String name, String ns, String& fixupReference) Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationReader1.Read6_getCurrentStormsResponse () [InvalidOperationException: There is an error in XML document (5, 2).] System.Xml.Serialization.XmlSerializer.Deserialize (XmlReader xmlReader, String encodingStyle) System.Xml.Serialization.XmlSerializer.Deserialize (XmlReader xmlReader) System.Web.Services.Protocols.SoapHttpClientProtoc ol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) System.Web.Services.Protocols.SoapHttpClientProtoc ol.Invoke(String methodName, Object[] parameters) HurricaneTracker.com.terrapin.weather.HurricaneSer viceService.getCurrentStorms() in c:\inetpub\wwwroot\HurricaneTracker\Web References\com.terrapin.weather\Reference.vb:44 HurricaneTracker.WebForm1.btnGetStormNames_Click(O bject sender, EventArgs e) in c:\inetpub\wwwroot\HurricaneTracker\WebForm1.aspx. vb:30 System.Web.UI.WebControls.Button.OnClick(EventArgs e) System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) System.Web.UI.Page.ProcessRequestMain() ************************************************** ************************************************** ************************************************** ************* I would be really helpful to me if someone can point out what is wrong in my code. Thanks Jignesh |
|
#2
|
|||
|
|||
|
Any progress?
Did you find a resolution? I have the same problem.
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > .NET Development > Asp.net Webservice simple question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|