Windows Client using Generated WS Proxy

Discussion in 'ASP .Net Web Services' started by Gravy, Sep 10, 2004.

  1. Gravy

    Gravy Guest

    Hi,

    How many people are using a windows client to talk to their web service? I'm
    interested on peoples view on using the classes that are generated
    automatically when a web reference is added. More specifically the class
    that represent the data that goes to and from the web service.

    In a very simple solution I can see the ease of using the generated classes
    but in a more complex solution does the case for using them still stand.

    I have an application that has a windows client talking to a set of services
    hosted in ASP.NET. Now whilst writing the service layer I created quite a
    few classes that represent the data to method calls, i.e. entity type
    classes. the typical sort of thing is a Customer or an Account.

    Now, if I expose a web method that takes a Customer or Account the client
    proxy that is generated automatically creates another definition for
    Customer and Account. If MY entities contain the data plus a little
    validation, i.e. Name cannot be empty or greater than 10 then I would want
    my client to use them as well as the server. But this means I now have a
    conflict. the WS Proxy thinks it knows what a Customer is and the client
    code also thinks it knows what a Customer is.

    Does anyone else suffer from these conflicts, or do people just use the
    proxy generated class.

    I can think of a couple of solutions to the problem.

    1) Change the reference.cs file to use my namespace for my Customer and
    Account class. Then remove the auto generated versions from this class.

    2) Manually convert from my definition of a Customer to the proxy's
    definition before a call the web service!!

    One aspect of this that I'm worried about is versioning!!

    Does anyone have any comments on this?

    Regards

    Graham Allwood
     
    Gravy, Sep 10, 2004
    #1
    1. Advertising

  2. Gravy

    Gravy Guest

    Thanks Tomas,

    It nice to know that I'm doing something that not totally alien.

    I think that without any compelling reason to change things I'm going to
    stick with the way we have things now, that is share data assembly between
    tiers, very similar to the way you did it.

    Has anyone else come accross this?

    Gravy

    "Tomas" <> wrote in message
    news:...
    > Hi Gravy,
    >
    > I have just completed a contract where I ran into the situation I just
    > described.
    >
    > I was using several class that were to be shared across the presentation
    > and
    > business tiers of my application. I have placed these data class e.g.
    > AddressData, UserData in an assembly I was planning to share across tiers.
    > The WSDL tool did indeed create "duplicates" of these classes which, to be
    > honest, really annoyed me.
    >
    > The solution I used was to generate one proxy using the tool and then I
    > simply went through it and modified it. Since I am using VSS, versioning
    > has
    > not been a real problem. Since the initial design of these data classes
    > I've
    > added some methods for presentation e.g. a toString() that puts the users
    > name together in a nice format.
    >
    > Overall it's been quite successful, but that partly stems from the fact
    > that
    > we had very good designs on our webservices before we started client side
    > development. Signatures have changed slightly, but you can modify the
    > custom
    > proxy without too much difficulty. Major headaches arise when you add new
    > webmethods, fortunately for me, that happened only one over the life of
    > the
    > project so it was only a minor task. This would be a big problem if
    > methods
    > were being added quite frequently.
    >
    > I hope this has been of some benefit to you. Let me know what you decided
    > to
    > do.
    >
    > Tom
    >
    > "Gravy" wrote:
    >
    >> Hi,
    >>
    >> How many people are using a windows client to talk to their web service?
    >> I'm
    >> interested on peoples view on using the classes that are generated
    >> automatically when a web reference is added. More specifically the class
    >> that represent the data that goes to and from the web service.
    >>
    >> In a very simple solution I can see the ease of using the generated
    >> classes
    >> but in a more complex solution does the case for using them still stand.
    >>
    >> I have an application that has a windows client talking to a set of
    >> services
    >> hosted in ASP.NET. Now whilst writing the service layer I created quite a
    >> few classes that represent the data to method calls, i.e. entity type
    >> classes. the typical sort of thing is a Customer or an Account.
    >>
    >> Now, if I expose a web method that takes a Customer or Account the client
    >> proxy that is generated automatically creates another definition for
    >> Customer and Account. If MY entities contain the data plus a little
    >> validation, i.e. Name cannot be empty or greater than 10 then I would
    >> want
    >> my client to use them as well as the server. But this means I now have a
    >> conflict. the WS Proxy thinks it knows what a Customer is and the client
    >> code also thinks it knows what a Customer is.
    >>
    >> Does anyone else suffer from these conflicts, or do people just use the
    >> proxy generated class.
    >>
    >> I can think of a couple of solutions to the problem.
    >>
    >> 1) Change the reference.cs file to use my namespace for my Customer and
    >> Account class. Then remove the auto generated versions from this class.
    >>
    >> 2) Manually convert from my definition of a Customer to the proxy's
    >> definition before a call the web service!!
    >>
    >> One aspect of this that I'm worried about is versioning!!
    >>
    >> Does anyone have any comments on this?
    >>
    >> Regards
    >>
    >> Graham Allwood
    >>
    >>
    >>
     
    Gravy, Sep 15, 2004
    #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. Arpan

    WSDL Generated Proxy Classes?

    Arpan, Sep 7, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    1,542
    Laurent Bugnion
    Sep 7, 2006
  2. Replies:
    2
    Views:
    309
    Twisted
    Aug 20, 2007
  3. Arthur Mnev
    Replies:
    0
    Views:
    138
    Arthur Mnev
    Feb 2, 2004
  4. NewsGroups
    Replies:
    0
    Views:
    270
    NewsGroups
    Aug 3, 2004
  5. A.M-SG
    Replies:
    2
    Views:
    392
    Steven Cheng[MSFT]
    Nov 2, 2005
Loading...

Share This Page