Question : SoapException when passing a class to web service

I'm using VS.NET 2008 to write some ASP.NET web services and using a VB.NET windows form app to test consuming these web services.  Most of it is all working fine, but I am coming unstuck when calling a web method and passing to it a class.  I am able to retrieve this class successfully through a different web method.  The offending codem and error:
----------------------
DATA CLASS
Public Class SIConfig
...
  Public Property SOEIDVersion() As String
        Get
            Return BaseConfig.SOEIDVersion
        End Get
        Set(ByVal value As String)
            BaseConfig.SOEIDVersion = value
            MasterConfig.SOEIDVersion = value
        End Set
    End Property
...
End Class
-------------------------
WEB METHOD
    _
   Public Function UpdateConfig(ByVal config As SOE.Builder.SIConfig) As Boolean
        'do nothing just yet - still testing calling this method
    End Function
------------------------
CALL TO WEB SERVICE FROM WINFORMS APP
public class Form1
    Private SIBConfig As New csib01_config.Config
    Private sic As csib01_config.SIConfig
....
  Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
            SIBConfig.UpdateConfig(sic)   ' <- exception being thrown here
    End Sub
----------------------------
SOAPEXCEPTION
System.Web.Services.Protocols.SoapException: Server was unable to read request. ---> System.InvalidOperationException: There is an error in XML document (1, 345). ---> System.NullReferenceException: Object reference not set to an instance of an object.    at SIConfig.set_SOEIDVersion(String value) in SIConfig.vb:line 29    at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read2_SIConfig(Boolean isNullable, Boolean checkType)    at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read7_UpdateConfig()    at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer8.Deserialize(XmlSerializationReader reader)    at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)    --- End of inner exception stack trace ---    at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)    at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)    at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters()    --- End of inner exception stack trace ---    at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters()    at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()
------------------

Seems to be something to do with deserializing the class as it is passed to the method.  Any ideas or suggestions?  I've tried everything I can think of.  Thanks, sj.

Answer : SoapException when passing a class to web service

System.NullReferenceException: Object reference not set to an instance of an object.    at SIConfig.set_SOEIDVersion(String value) in SIConfig.vb:line 29    


as stated above can you check line 29 of code at SIConfig.vb and see why the null reference exception is coming.
Random Solutions  
 
programming4us programming4us