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

Discussion in 'ASP .Net Web Services' started by Quan, Jan 21, 2005.

  1. Quan

    Quan Guest

    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
     
    Quan, Jan 21, 2005
    #1
    1. Advertising

  2. 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

    > 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
     
    Dilip Krishnan, Jan 21, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Carlos Alejandro Pérez

    Passing back and forth parameters to modal browser windows

    Carlos Alejandro Pérez, Jun 8, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    528
    Eliyahu Goldin
    Jun 8, 2005
  2. Kieran Benton
    Replies:
    1
    Views:
    900
    souri challa
    Jun 30, 2005
  3. Replies:
    3
    Views:
    1,371
  4. bernd
    Replies:
    1
    Views:
    804
    bernd
    Jun 13, 2008
  5. Matt
    Replies:
    0
    Views:
    194
Loading...

Share This Page