Using library classes instead of proxy classes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?Sm9l?=

    #1

    Using library classes instead of proxy classes

    I have a .NET class library called NorthwindLib and a class called Customer.
    I have a web server that exposes a web method GetCustomer() and returns a
    NorthwindLib.Cu stomer object.

    I want to consume this web service in another .NET application that
    references NorthwindLib. When the web reference is created I want the
    GetCustomer method to return an instance of NorthwindLib.Cu stomer NOT a
    generated ServiceProxy.Cu stomer.

    What is the easiest way to accomplish this?

    From what I have found I could create a SchemaImporter object that maps the
    types in the WSDL to a known type in my class library. However, this
    solution appears to require a DLL to be built and installed/configured on
    each developer machine. I would really like something that is a
    project-level solution that doesn't require additional special machine
    configuration. Is this possible?

    Does WCF address this scenario more gracefully than ASP.NET 2.0 Web Services?
  • =?Utf-8?B?TWFyayBOZWxzb24=?=

    #2
    RE: Using library classes instead of proxy classes

    Joe,

    Whether it is Service.Custome r or Library(dll).Cu stomer it's jus a customer
    object.
    I assum you need Customer object at the Service end, just for the sake of
    typecasting the object returned from library.
    If you see WSDL it should be your
    Customer Object with all public properties and methods serialized. I don't
    find any problem with this.

    Do you want to address the scenario where the Serivce.Custome r and
    Library(dll).Cu stomer object has different defintion and you want to address
    them.

    Could you please elaborate me more on your requirement ?


    --
    Thanks & Regards,
    Mark Nelson


    "Joe" wrote:
    I have a .NET class library called NorthwindLib and a class called Customer.
    I have a web server that exposes a web method GetCustomer() and returns a
    NorthwindLib.Cu stomer object.
    >
    I want to consume this web service in another .NET application that
    references NorthwindLib. When the web reference is created I want the
    GetCustomer method to return an instance of NorthwindLib.Cu stomer NOT a
    generated ServiceProxy.Cu stomer.
    >
    What is the easiest way to accomplish this?
    >
    From what I have found I could create a SchemaImporter object that maps the
    types in the WSDL to a known type in my class library. However, this
    solution appears to require a DLL to be built and installed/configured on
    each developer machine. I would really like something that is a
    project-level solution that doesn't require additional special machine
    configuration. Is this possible?
    >
    Does WCF address this scenario more gracefully than ASP.NET 2.0 Web Services?

    Comment

    • Joseph Geretz

      #3
      Re: Using library classes instead of proxy classes

      Hi Joe,

      Have a look at the sample project which I posted to Josh's topic 'Sharing
      web-service class between two local assemblies'. Basically, you can simply
      edit the generated proxy to use your desired class definition, rather than
      its own class definition whch is created by default.

      Hope this helps,

      - Joseph Geretz -

      "Joe" <Joe@discussion s.microsoft.com wrote in message
      news:2F925735-8135-42F1-B844-02888E381DF7@mi crosoft.com...
      >I have a .NET class library called NorthwindLib and a class called
      >Customer.
      I have a web server that exposes a web method GetCustomer() and returns a
      NorthwindLib.Cu stomer object.
      >
      I want to consume this web service in another .NET application that
      references NorthwindLib. When the web reference is created I want the
      GetCustomer method to return an instance of NorthwindLib.Cu stomer NOT a
      generated ServiceProxy.Cu stomer.
      >
      What is the easiest way to accomplish this?
      >
      From what I have found I could create a SchemaImporter object that maps
      the
      types in the WSDL to a known type in my class library. However, this
      solution appears to require a DLL to be built and installed/configured on
      each developer machine. I would really like something that is a
      project-level solution that doesn't require additional special machine
      configuration. Is this possible?
      >
      Does WCF address this scenario more gracefully than ASP.NET 2.0 Web
      Services?

      Comment

      • John Saunders

        #4
        Re: Using library classes instead of proxy classes

        "Joseph Geretz" <jgeretz@nospam .comwrote in message
        news:%23wyeTyIW HHA.3592@TK2MSF TNGP03.phx.gbl. ..
        Hi Joe,
        >
        Have a look at the sample project which I posted to Josh's topic 'Sharing
        web-service class between two local assemblies'. Basically, you can simply
        edit the generated proxy to use your desired class definition, rather than
        its own class definition whch is created by default.
        Jopseph, that's a very bad idea. The proxy class is generated code. As soon
        as Update Web Reference is used, any edits are destroyed.


        John


        Comment

        • Joseph Geretz

          #5
          Re: Using library classes instead of proxy classes

          Jopseph, that's a very bad idea. The proxy class is generated code. As
          soon as Update Web Reference is used, any edits are destroyed.
          Of course, this is the obvious caveat. Whatever generated the proxy in the
          first place is going to re-generate it when the reference is refreshed.
          Whether or not this is a 'bad idea' would depend on the context in which
          it's being used. There are other ways to approach this issue. However
          (contrary to your assertion) this possibility exits. I'd allow developers
          with more knowledge regarding their perticular scenario to decide for
          themselves whether or not it is a 'bad idea' for their specific situation.

          Your resistance to this approach doesn't seem quite consistent with your
          previously stated distaste for 'magically generated' wired-up
          infrastructure - the 'training wheels' as you so eloquently describe it. The
          bottom line is, if you're willing to put some edits in place, this can be a
          workable solution. Especially, once you get your Web Service interface
          locked down, and are no longer updating Web References with any degree of
          frequency.

          - Joseph Geretz -

          "John Saunders" <john.saunder s at trizetto.comwro te in message
          news:e4ePnLOWHH A.1200@TK2MSFTN GP02.phx.gbl...
          "Joseph Geretz" <jgeretz@nospam .comwrote in message
          news:%23wyeTyIW HHA.3592@TK2MSF TNGP03.phx.gbl. ..
          >Hi Joe,
          >>
          >Have a look at the sample project which I posted to Josh's topic 'Sharing
          >web-service class between two local assemblies'. Basically, you can
          >simply edit the generated proxy to use your desired class definition,
          >rather than its own class definition whch is created by default.
          >
          Jopseph, that's a very bad idea. The proxy class is generated code. As
          soon as Update Web Reference is used, any edits are destroyed.
          >
          >
          John
          >
          >

          Comment

          Working...