Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. WS and DesktopApplication

WS and DesktopApplication

Scheduled Pinned Locked Moved C#
csharpasp-netdatabasewcfdebugging
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Andrei Ungureanu
    wrote on last edited by
    #1

    Hello, I have a small problem. I built a ASP.NET WebService that retrieves data from a database. I have a function in the webservice that receives a parameter, and the return type is an object created by me. UserInfoCollection is a class created by me that contains an ArrayList with will cotain several UserInfo objects. This is the function in the webservice: [WebMethod] public UserInfoCollection GetUsersByType(AccountTypes account) { UserInfoCollection collection = new UserInfoCollection(); //fill the collection with data from database return collection; } To use the methods from the webservice I build a proxy using the WSDL utility. This is how i use this function: WSService ws = new WSService(); UserInfoCollection _uicUsers = ws.GetUsersByType(type); Using debug mode I saw that the webservice inserts into the collection everything that he has to, but when the webservice returns the collection object, in the application the object has no values inside. After the return statement, the webservice reinitializez the object. My question is that anyone has a suggestion to get past this problem. Thank you.

    Do your best to be the best

    P L 2 Replies Last reply
    0
    • A Andrei Ungureanu

      Hello, I have a small problem. I built a ASP.NET WebService that retrieves data from a database. I have a function in the webservice that receives a parameter, and the return type is an object created by me. UserInfoCollection is a class created by me that contains an ArrayList with will cotain several UserInfo objects. This is the function in the webservice: [WebMethod] public UserInfoCollection GetUsersByType(AccountTypes account) { UserInfoCollection collection = new UserInfoCollection(); //fill the collection with data from database return collection; } To use the methods from the webservice I build a proxy using the WSDL utility. This is how i use this function: WSService ws = new WSService(); UserInfoCollection _uicUsers = ws.GetUsersByType(type); Using debug mode I saw that the webservice inserts into the collection everything that he has to, but when the webservice returns the collection object, in the application the object has no values inside. After the return statement, the webservice reinitializez the object. My question is that anyone has a suggestion to get past this problem. Thank you.

      Do your best to be the best

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      Are your UserInfoCollection and UserInfo classes marked as Serializable?

      Deja View - the feeling that you've seen this post before.

      A 1 Reply Last reply
      0
      • A Andrei Ungureanu

        Hello, I have a small problem. I built a ASP.NET WebService that retrieves data from a database. I have a function in the webservice that receives a parameter, and the return type is an object created by me. UserInfoCollection is a class created by me that contains an ArrayList with will cotain several UserInfo objects. This is the function in the webservice: [WebMethod] public UserInfoCollection GetUsersByType(AccountTypes account) { UserInfoCollection collection = new UserInfoCollection(); //fill the collection with data from database return collection; } To use the methods from the webservice I build a proxy using the WSDL utility. This is how i use this function: WSService ws = new WSService(); UserInfoCollection _uicUsers = ws.GetUsersByType(type); Using debug mode I saw that the webservice inserts into the collection everything that he has to, but when the webservice returns the collection object, in the application the object has no values inside. After the return statement, the webservice reinitializez the object. My question is that anyone has a suggestion to get past this problem. Thank you.

        Do your best to be the best

        L Offline
        L Offline
        leppie
        wrote on last edited by
        #3

        The data you want to expose need to be public. Remember webservices only make a wrapper for your class's public data.

        **

        xacc.ide-0.2.0.74 - now with C# 3.5 support!

        **

        A 1 Reply Last reply
        0
        • P Pete OHanlon

          Are your UserInfoCollection and UserInfo classes marked as Serializable?

          Deja View - the feeling that you've seen this post before.

          A Offline
          A Offline
          Andrei Ungureanu
          wrote on last edited by
          #4

          Hey, First of all thanks for your reply. The classes are not marked as Serializable, but I also have a function in the WebService that returns a UserInfo object and it works perfect. If I use the UserInfoCollection...problems. I found some way to go around, but this bugs me a lot...because I can't understand why it's doing this.

          Do your best to be the best

          1 Reply Last reply
          0
          • L leppie

            The data you want to expose need to be public. Remember webservices only make a wrapper for your class's public data.

            **

            xacc.ide-0.2.0.74 - now with C# 3.5 support!

            **

            A Offline
            A Offline
            Andrei Ungureanu
            wrote on last edited by
            #5

            Hey, Thanks for your reply. The classes are marked as public and the methods that I need are also public, but in debug mode when the webservice returns the collection object first of all it reinitialize my private objects and then calls the constructor of the class. These classes I talk about are wrapped in a DLL and imported in the WS.

            Do your best to be the best

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups