C
Chris Dunaway
I have a custom class called User with fields like Name, Address, etc.
This is compiled into a .dll.
I also have a Windows app that will reference a couple of web services.
Both the Windows app and the Webservices will use this User class.
Each web service references the .dll to get the user class. My Windows app
also references the .dll to get the User class.
My problem arises when I reference the web services. I can reference them
ok but they each have their own version of the User class! Further, they
are not compatible.
For example, my .dll with the User class has a namespace of MyNamespace and
the two web services are as follows:
Authenticate.asmx references the .dll and has the following method:
Imports MyNamespace
<WebMethod> _
Public Function Login(usr as String, pwd As String) As User
End Function
MainWebService.asmx also references the .dll has the folowing method:
Imports MyNamespace
<WebMethod> _
Public Sub Process(usr As User)
End Sub
All seems OK but when I reference both web services from my windows App, I
get two 'extra' User classes. I want to call them this way:
Public Sub CallWebServices()
Dim oAuth As New Authenticate
Dim oMain As New MainWebService
Dim oUsr As MyNamespace.User
oUsr = oAuth.Login("user","password")
'The line above fails stating that an object of type MyNamespace.User
'cannot be converted to an object of type Authenticate.User
'If I use the following:
Dim oUsr2 As Authenticate.User
oUsr2 = oAuth.Login("user", "password")
'The above seems to work OK but then the following line fails saying
'An object of type Authenticate.User cannot be converted to
'MainWebService.User
oMain.Process(oUsr2) 'This fails
End Sub
I can change the Reference.vb files for each web service to use the correct
user class (the one in MyNamespace) but if I update the web service then
the changes will be lost.
How can I use a custom class in a Windows App that references a web service
and have the web service return the correct types?
--
Chris
dunawayc[AT]sbcglobal_lunchmeat_[DOT]net
To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
This is compiled into a .dll.
I also have a Windows app that will reference a couple of web services.
Both the Windows app and the Webservices will use this User class.
Each web service references the .dll to get the user class. My Windows app
also references the .dll to get the User class.
My problem arises when I reference the web services. I can reference them
ok but they each have their own version of the User class! Further, they
are not compatible.
For example, my .dll with the User class has a namespace of MyNamespace and
the two web services are as follows:
Authenticate.asmx references the .dll and has the following method:
Imports MyNamespace
<WebMethod> _
Public Function Login(usr as String, pwd As String) As User
End Function
MainWebService.asmx also references the .dll has the folowing method:
Imports MyNamespace
<WebMethod> _
Public Sub Process(usr As User)
End Sub
All seems OK but when I reference both web services from my windows App, I
get two 'extra' User classes. I want to call them this way:
Public Sub CallWebServices()
Dim oAuth As New Authenticate
Dim oMain As New MainWebService
Dim oUsr As MyNamespace.User
oUsr = oAuth.Login("user","password")
'The line above fails stating that an object of type MyNamespace.User
'cannot be converted to an object of type Authenticate.User
'If I use the following:
Dim oUsr2 As Authenticate.User
oUsr2 = oAuth.Login("user", "password")
'The above seems to work OK but then the following line fails saying
'An object of type Authenticate.User cannot be converted to
'MainWebService.User
oMain.Process(oUsr2) 'This fails
End Sub
I can change the Reference.vb files for each web service to use the correct
user class (the one in MyNamespace) but if I update the web service then
the changes will be lost.
How can I use a custom class in a Windows App that references a web service
and have the web service return the correct types?
--
Chris
dunawayc[AT]sbcglobal_lunchmeat_[DOT]net
To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.