Hi,
I am a newbie to Web Service and I cannot figure how to share a user defined
type between a Windows application and a Web Service.
I have a Windows Forms application and a Web Service, both referring to an
assembly which defines a simple structure (see code below).
When I try to compile the solution (VB.NET 2003) I get the following error
at the line marked 'Error here' in the code for 'Form1_Load':
Unable to connvert the type value "TestTipiWS.WSTipi.Persona" into
"Persone.Persona".
If I change the declaration of p into:
Dim p As WSTipi.Persona
the solution compiles and works as expected, but I would like to have a
single type definition.
Any suggestion?
Thanks!
------------------------------
Paolo Nunberg
pa***********@tin.it
*** Type definition assembly ***
Namespace Persone
Public Structure Persona
Dim ID As Integer
Dim Nome As String
End Structure
End Namespace
*** Form code ***
Imports Persone
....
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim Sv As New WSTipi.ServTipi
Dim p As Persona
p = Sv.GetPersona() '*** Error here ***
lbID.Text = p.ID
lbNome.Text = p.Nome
End Sub
*** Web Service ***
......
Imports Persone
<System.Web.Services.WebService(Namespace:="http ://tempuri.org/ProvaWS/ServT
ipi"
)> _
Public Class ServTipi
Inherits System.Web.Services.WebService
......
<WebMethod()> _
Public Function GetPersona() As Persona
Dim p As Persona
p.ID = 11581
p.Nome = "Paolo Nunberg"
Return p
End Function
End Class