can you pass user created class back and forth with web services?

Q

Quan

My web service and client are trying to send objects of a
user defind class.
There are 3 projects in my solution:
1)BusinessObject -->contains a LoginRequest class
2)MyWebService -->contains a web service class
LoginManager
public bool Login( LoginRequest userlogin)

3)MainClient -->calls the web service. (web service name
is localhost)
public static bool Login(LoginRequest userlogin)
{
localhost.LoginManager ws=new localhost.LoginManager()
ws.Login(userlogin)
}

I got the compile error :
value of BusinessObject.LoginRequest can not be convert
to localhost.LoginRequest...

Could someone help?
Thanks
 
D

Dilip Krishnan

Hello Quan,
You cannot share types between web services and the client (1 & 3). Even
though the 2 objects look the same, just like your message says your namespaces
are different. So best way to use it is create a helper method that is able
to convert between those types. There are other work arounds [0] to getting
that done but I'd discourage you from doing so.

[0] - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnservice/html/service07162002.asp
HTH
Regards,
Dilip Krishnan
MCAD, MCSD.net
dkrishnan at geniant dot com
http://www.geniant.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top