L
Lachlan Gemmell
I'm having problems returning complex types from my web service.
The error I receive is
"Value of type 'MyApp.localhost.TransferObject' cannot be converted to
'Transfer.TransferObject'"
Inside my transfer.dll the following class (simplified here) is declared
<Serializable()> Public Class ReportTransferObject
Private m_FileName As String
Private m_FilePath As String
Private m_Data() As Byte
End Class
My web service imports the transfer.dll and declares the following function
<WebService(Namespace:="http://blahblahblah.com/")> _
Public Class MyWebService
<WebMethod()> Public Function Execute() As Transfer.TransferObject
Dim theData As Transfer.TransferObject()
'do stuff
Return theData
End Function
End Class
The consuming application (MyApp) also imports the transfer.dll and calls
the web service as follows
Dim theData as Transfer.TransferObject
theData = MyWebService.Execute()
However doing so results in the following error
"Value of type 'MyApp.localhost.TransferObject' cannot be converted to
'Transfer.TransferObject'."
I am unable to cast using either CType or DirectCast without an exception
being thrown at runtime.
Why is the web service not transferring the object as being of type
Transfer.TransferObject? If I try to return a complex type such as DataSet
it can work that out no problems.
Regards,
Lachlan
The error I receive is
"Value of type 'MyApp.localhost.TransferObject' cannot be converted to
'Transfer.TransferObject'"
Inside my transfer.dll the following class (simplified here) is declared
<Serializable()> Public Class ReportTransferObject
Private m_FileName As String
Private m_FilePath As String
Private m_Data() As Byte
End Class
My web service imports the transfer.dll and declares the following function
<WebService(Namespace:="http://blahblahblah.com/")> _
Public Class MyWebService
<WebMethod()> Public Function Execute() As Transfer.TransferObject
Dim theData As Transfer.TransferObject()
'do stuff
Return theData
End Function
End Class
The consuming application (MyApp) also imports the transfer.dll and calls
the web service as follows
Dim theData as Transfer.TransferObject
theData = MyWebService.Execute()
However doing so results in the following error
"Value of type 'MyApp.localhost.TransferObject' cannot be converted to
'Transfer.TransferObject'."
I am unable to cast using either CType or DirectCast without an exception
being thrown at runtime.
Why is the web service not transferring the object as being of type
Transfer.TransferObject? If I try to return a complex type such as DataSet
it can work that out no problems.
Regards,
Lachlan