How to copy data from CLR object to its proxy?

Ask a Question related to ASP.NET Web Services, Design and Development.

  1. #1

    Default How to copy data from CLR object to its proxy?

    On the client, I have a type myAssembly.myClass from the same assembly
    the server uses, and its proxy, localhost.myClass, generated via the
    Web Reference.

    I can call Web Methods passing objects of type localhost.myClass
    without any trouble. But what I need to be able to do is pass (the
    data from) myAssembly.myClass objects on the client.

    It isn't possible to cast from myAssembly.myClass to localhost.myClass
    using CType. I could write code manually to copy data memberwise from
    a myAssembly.myClass object to a localhost.myClass object, but the
    class is huge and so it would create terrible maintenance problems.

    I can't quite understand why there aren't hundreds of people out there
    with this problem -- I must be missing something obvious. Do people
    really fill in the fields of object parameters to web services without
    ever needing to take the values from a CLR object?

    Anyway, is there any sensible way to copy the data from a CLR object
    to its Web Service proxy?

    Thank you very much for any help,

    Max Christian
    [replace NEWS with my first name in email address to respond]
    Max Christian Guest

  2. Similar Questions and Discussions

    1. Copy Display Object
      Hey Guys, Is there a way to create an exact copy of a display object and all its children to add some where else on the canvas? So basically if i...
    2. Proxy Shared Object Creation Difficulty
      I am having difficulty creating a proxy shared object. The instance folder gets created but it doesn't seem like data gets put into the shared...
    3. Proxy object error
      Greetings, I have created a relatively simple (client-side) application that accesses several web services from a server. I am using proxy...
    4. how can one copy an object with state?
      This doesn't copy state: $myNewObject = $myOldObject; This does, but it doesn't copy: $myNewObject = & $myOldObject;
    5. Copy object
      How can I copy an object, generated in an vb.net windows applic. into an asp.net application? Thanks Ric
  3. #2

    Default Re: How to copy data from CLR object to its proxy?

    I agree: this is the problem a lot of people who are starting with web
    services are facing. You really need to be aware that you are dealing with
    proxy classes on your client side.

    First of all I have to say: what you are trying to do is not really "service
    oriented". Service orientation is all about sharing schema's instead of
    sharing types. When you use a web service in your application there is a
    clear separation between your business logic and your client, that
    separation is the web service. There are many articles written about SOA,
    and they probably explain things a lot better than I do, so I suggest you
    Google for "Service Oriented Architecture" or take a look at following
    articles:

    [url]http://msdn.microsoft.com/architecture/journal/default.aspx?pull=/library/en-us/dnmaj/html/aj1soa.asp[/url]
    [url]http://msdn.microsoft.com/architecture/journal/default.aspx[/url]

    Secondly, if you really want to share types instead of schema's: you can use
    your assembly on your client side. You only need to alter the generated code
    of the web service reference, so it will use your class instead of the proxy
    class.

    --
    Greetz
    Jan
    ________________
    Read my weblog: [url]http://weblogs.asp.net/jan[/url]


    "Max Christian" <news@maxuk.net> schreef in bericht
    news:c6ad177c.0405312215.168e33c1@posting.google.c om...
    > On the client, I have a type myAssembly.myClass from the same assembly
    > the server uses, and its proxy, localhost.myClass, generated via the
    > Web Reference.
    >
    > I can call Web Methods passing objects of type localhost.myClass
    > without any trouble. But what I need to be able to do is pass (the
    > data from) myAssembly.myClass objects on the client.
    >
    > It isn't possible to cast from myAssembly.myClass to localhost.myClass
    > using CType. I could write code manually to copy data memberwise from
    > a myAssembly.myClass object to a localhost.myClass object, but the
    > class is huge and so it would create terrible maintenance problems.
    >
    > I can't quite understand why there aren't hundreds of people out there
    > with this problem -- I must be missing something obvious. Do people
    > really fill in the fields of object parameters to web services without
    > ever needing to take the values from a CLR object?
    >
    > Anyway, is there any sensible way to copy the data from a CLR object
    > to its Web Service proxy?
    >
    > Thank you very much for any help,
    >
    > Max Christian
    > [replace NEWS with my first name in email address to respond]

    Jan Tielens Guest

  4. #3

    Default Re: How to copy data from CLR object to its proxy?

    "Jan Tielens" <jan@no.spam.please.leadit.be> wrote...
    > First of all I have to say: what you are trying to do is not really "service
    > oriented". Service orientation is all about sharing schema's instead of
    Thanks Jan, modifying the generated code fixed it and thanks to your
    explanation of SOA I can see why a bit of a hack is necessary.

    I'm converting a project that appropriately uses .NET Remoting to use
    Web Services instead when it isn't really the right technology. Why?
    Because Web Services can be accessed from code running in the internet
    zone, whereas Remoting cannot. It's a hack but the zero-touch
    deployment makes it very rewarding.

    Cheers,

    Max Christian
    Max Christian Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139