Connecting Tech Pros Worldwide Help | Site Map

Using library classes instead of proxy classes

=?Utf-8?B?Sm9l?=
Guest
 
Posts: n/a
#1: Feb 23 '07
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.Customer 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.Customer NOT a
generated ServiceProxy.Customer.

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=?=
Guest
 
Posts: n/a
#2: Feb 23 '07

re: Using library classes instead of proxy classes


Joe,

Whether it is Service.Customer or Library(dll).Customer 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.Customer and
Library(dll).Customer 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:
Quote:
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.Customer 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.Customer NOT a
generated ServiceProxy.Customer.
>
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?
Joseph Geretz
Guest
 
Posts: n/a
#3: Feb 25 '07

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@discussions.microsoft.comwrote in message
news:2F925735-8135-42F1-B844-02888E381DF7@microsoft.com...
Quote:
>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.Customer 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.Customer NOT a
generated ServiceProxy.Customer.
>
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?

John Saunders
Guest
 
Posts: n/a
#4: Feb 25 '07

re: Using library classes instead of proxy classes


"Joseph Geretz" <jgeretz@nospam.comwrote in message
news:%23wyeTyIWHHA.3592@TK2MSFTNGP03.phx.gbl...
Quote:
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


Joseph Geretz
Guest
 
Posts: n/a
#5: Feb 25 '07

re: Using library classes instead of proxy classes


Jopseph, that's a very bad idea. The proxy class is generated code. As
Quote:
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.saunders at trizetto.comwrote in message
news:e4ePnLOWHHA.1200@TK2MSFTNGP02.phx.gbl...
Quote:
"Joseph Geretz" <jgeretz@nospam.comwrote in message
news:%23wyeTyIWHHA.3592@TK2MSFTNGP03.phx.gbl...
Quote:
>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
>
>

Closed Thread