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. Passing an [in] parameter to an asp.net web service

Passing an [in] parameter to an asp.net web service

Scheduled Pinned Locked Moved C#
questioncsharpasp-nethardwarejson
3 Posts 2 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.
  • M Offline
    M Offline
    Mehdi Mousavi
    wrote on last edited by
    #1

    Hi, Consider a class that I need to serialize and send over the wire. On the receiving end, the serialization bytes have to be re-constructed to form the object. The mentioned class has got some member variables and one or more constructors. [WebMethod()] public void Test(MyClass c) {} The question is that is there anyway to control the proxy-generation for the MyClass class? i.e, how am I supposed to force the proxy-generator to generate the constuctors? Or should I add the required constructors on the client side using the partial keyword? What's the best thing to do when you want to pass a one-way informative parameter (ie., no functionality embedded except for the constructors) to a web method? I would like the client side to create the object normally as follows: MyWebService.MyClass c = new MyWebService.MyClass(param1, param2); MyWebService.Test(c); Is there anyway to achieve such functionality? TIA, Mehdi

    L 1 Reply Last reply
    0
    • M Mehdi Mousavi

      Hi, Consider a class that I need to serialize and send over the wire. On the receiving end, the serialization bytes have to be re-constructed to form the object. The mentioned class has got some member variables and one or more constructors. [WebMethod()] public void Test(MyClass c) {} The question is that is there anyway to control the proxy-generation for the MyClass class? i.e, how am I supposed to force the proxy-generator to generate the constuctors? Or should I add the required constructors on the client side using the partial keyword? What's the best thing to do when you want to pass a one-way informative parameter (ie., no functionality embedded except for the constructors) to a web method? I would like the client side to create the object normally as follows: MyWebService.MyClass c = new MyWebService.MyClass(param1, param2); MyWebService.Test(c); Is there anyway to achieve such functionality? TIA, Mehdi

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

      After the code has been generated, you can add them. As long as you stick to serialization standards (mark your public properties/fields as XmlIgnore, and dont delete their fields!). If using .NET 2.0, partial classes gets generated, and hence u can define them in another file without worrying that regeneration will erase your changes.

      **

      xacc.ide-0.2.0.57 - now with C# 2.0 parser and seamless VS2005 solution support!

      **

      M 1 Reply Last reply
      0
      • L leppie

        After the code has been generated, you can add them. As long as you stick to serialization standards (mark your public properties/fields as XmlIgnore, and dont delete their fields!). If using .NET 2.0, partial classes gets generated, and hence u can define them in another file without worrying that regeneration will erase your changes.

        **

        xacc.ide-0.2.0.57 - now with C# 2.0 parser and seamless VS2005 solution support!

        **

        M Offline
        M Offline
        Mehdi Mousavi
        wrote on last edited by
        #3

        Is there any keyword and/or pragma (like the one used in IDL (C++)) to force the compiler to put some code in the generated class? something like: #include_this_in_generated_code "public void WhateverMethod() {}" This way, I could alter the proxy code on service-side. Thanks, Mehdi

        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