Extending web service proxy classes

S

Sarge

Hi all,
tough question. Apologies for the cross posting but it is an interesting
architectural problem and I think deserves a wide audience.

What is the best way to extend web service proxy classes so we can add
our own methods and properties?

We have an application that passes a deep hierarchical structure (four
nodes deep) between a webservice and a smart client.
We have built the web service using the Contract First Web Service Tool,
which essentially builds nice web service proxy classes from a WSDL and xml
schemas, nothing new here. This tool uses the xsd.exe generation tool + IDE
integration, rather nice.
On the client side of the application we need to do some complex / semi
real time processing on this hierarchy before sending it back.

We would like to extend the web service proxy classes without modifying
the generated class files directly as we know that these things tend to
change and code generation is a big help in this manner.

We need properties and methods to be added to the individual web service
proxy classes

Attempts
We have tried inheriting from the web service proxy class.
This didn't work so well for two reasons
a) we can't down cast from a super class into sub class. i.e can't
cast from a type Dog into type Dalmatian
b) we have a hierarchy of classes so even if we can get a successful
cast into a Dalmatian class if we have a collection of FriendsToSniff they
would need to be cast as well...

Another option is to recreate the whole hierarchy, this seems to be an
expensive option after all the xmldeserializer has just kinda done all this
creating.

Another other option is use some kind of helper class which we could use to
help with the processing, this would be possible but complicated and would
not support the addition of properties easily as new properties would need
to be implemented as hashtables inside the helper class or something like
that. Helper classes are good for processing but not properties and state.

So you code hounds and architectural sleuths what do you think??

Thanks in advance

Mark
 
S

Steven Cheng[MSFT]

Hi Sarge,

Welcome to Webservice newsgroup.
As for the question you mentioned, I think it's really a tough question.
IMO, the best choice should be modify the autogenerated proxy code since
that's quite direct and convenient. However, since the proxy files are
autogenerated and our custom code may be override unexpectedly. In .NET
2.0, there provide the new partial class which can help separate one
class's code into mutliple source files. and for those IDE generated
classes, VS.NET will seprate the IDE generated code from user's custom code.

Also, as for the downcasting issue you mentioned in the creating derived
class(from auto generated proxy) means, would you provide some more detaile
description? Maybe you can use a simple example to describe the scenario
you currently meet so that we can get a more visualized concept.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


--------------------
| From: "Sarge" <[email protected]>
| Subject: Extending web service proxy classes
| Date: Tue, 1 Nov 2005 09:33:01 +1300
| Lines: 53
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| X-RFC2646: Format=Flowed; Original
| Message-ID: <[email protected]>
| Newsgroups:
microsoft.public.dotnet.framework.aspnet.webservices,microsoft.public.dotnet
..framework.webservices,microsoft.public.webservices
| NNTP-Posting-Host: 222-153-144-207.jetstream.xtra.co.nz 222.153.144.207
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.webservices:8417
microsoft.public.webservices:1236
microsoft.public.dotnet.framework.aspnet.webservices:8210
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
|
| Hi all,
| tough question. Apologies for the cross posting but it is an
interesting
| architectural problem and I think deserves a wide audience.
|
| What is the best way to extend web service proxy classes so we can add
| our own methods and properties?
|
| We have an application that passes a deep hierarchical structure
(four
| nodes deep) between a webservice and a smart client.
| We have built the web service using the Contract First Web Service
Tool,
| which essentially builds nice web service proxy classes from a WSDL and
xml
| schemas, nothing new here. This tool uses the xsd.exe generation tool +
IDE
| integration, rather nice.
| On the client side of the application we need to do some complex /
semi
| real time processing on this hierarchy before sending it back.
|
| We would like to extend the web service proxy classes without
modifying
| the generated class files directly as we know that these things tend to
| change and code generation is a big help in this manner.
|
| We need properties and methods to be added to the individual web
service
| proxy classes
|
| Attempts
| We have tried inheriting from the web service proxy class.
| This didn't work so well for two reasons
| a) we can't down cast from a super class into sub class. i.e
can't
| cast from a type Dog into type Dalmatian
| b) we have a hierarchy of classes so even if we can get a
successful
| cast into a Dalmatian class if we have a collection of FriendsToSniff
they
| would need to be cast as well...
|
| Another option is to recreate the whole hierarchy, this seems to be an
| expensive option after all the xmldeserializer has just kinda done all
this
| creating.
|
| Another other option is use some kind of helper class which we could use
to
| help with the processing, this would be possible but complicated and
would
| not support the addition of properties easily as new properties would
need
| to be implemented as hashtables inside the helper class or something like
| that. Helper classes are good for processing but not properties and state.
|
| So you code hounds and architectural sleuths what do you think??
|
| Thanks in advance
|
| Mark
|
|
|
|
|
|
|
 
S

Steven Cheng[MSFT]

Hi Sarge,

Have you got any further progress or new ideas on this? If there're
anything else we can help, please feel free to post here.
Also, welcome to sharing any of your good ideas with us.
Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| X-Tomcat-ID: 160503447
| References: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: (e-mail address removed) (Steven Cheng[MSFT])
| Organization: Microsoft
| Date: Tue, 01 Nov 2005 09:49:27 GMT
| Subject: RE: Extending web service proxy classes
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
| Lines: 109
| Path: TK2MSFTNGXA01.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet.webservices:8214
| NNTP-Posting-Host: tomcatimport2.phx.gbl 10.201.218.182
|
| Hi Sarge,
|
| Welcome to Webservice newsgroup.
| As for the question you mentioned, I think it's really a tough question.
| IMO, the best choice should be modify the autogenerated proxy code since
| that's quite direct and convenient. However, since the proxy files are
| autogenerated and our custom code may be override unexpectedly. In .NET
| 2.0, there provide the new partial class which can help separate one
| class's code into mutliple source files. and for those IDE generated
| classes, VS.NET will seprate the IDE generated code from user's custom
code.
|
| Also, as for the downcasting issue you mentioned in the creating derived
| class(from auto generated proxy) means, would you provide some more
detaile
| description? Maybe you can use a simple example to describe the scenario
| you currently meet so that we can get a more visualized concept.
|
| Thanks,
|
| Steven Cheng
| Microsoft Online Support
|
| Get Secure! www.microsoft.com/security
| (This posting is provided "AS IS", with no warranties, and confers no
| rights.)
|
|
| --------------------
| | From: "Sarge" <[email protected]>
| | Subject: Extending web service proxy classes
| | Date: Tue, 1 Nov 2005 09:33:01 +1300
| | Lines: 53
| | X-Priority: 3
| | X-MSMail-Priority: Normal
| | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| | X-RFC2646: Format=Flowed; Original
| | Message-ID: <[email protected]>
| | Newsgroups:
|
microsoft.public.dotnet.framework.aspnet.webservices,microsoft.public.dotnet
| .framework.webservices,microsoft.public.webservices
| | NNTP-Posting-Host: 222-153-144-207.jetstream.xtra.co.nz 222.153.144.207
| | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| | Xref: TK2MSFTNGXA01.phx.gbl
| microsoft.public.dotnet.framework.webservices:8417
| microsoft.public.webservices:1236
| microsoft.public.dotnet.framework.aspnet.webservices:8210
| | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
| |
| | Hi all,
| | tough question. Apologies for the cross posting but it is an
| interesting
| | architectural problem and I think deserves a wide audience.
| |
| | What is the best way to extend web service proxy classes so we can
add
| | our own methods and properties?
| |
| | We have an application that passes a deep hierarchical structure
| (four
| | nodes deep) between a webservice and a smart client.
| | We have built the web service using the Contract First Web Service
| Tool,
| | which essentially builds nice web service proxy classes from a WSDL and
| xml
| | schemas, nothing new here. This tool uses the xsd.exe generation tool +
| IDE
| | integration, rather nice.
| | On the client side of the application we need to do some complex /
| semi
| | real time processing on this hierarchy before sending it back.
| |
| | We would like to extend the web service proxy classes without
| modifying
| | the generated class files directly as we know that these things tend to
| | change and code generation is a big help in this manner.
| |
| | We need properties and methods to be added to the individual web
| service
| | proxy classes
| |
| | Attempts
| | We have tried inheriting from the web service proxy class.
| | This didn't work so well for two reasons
| | a) we can't down cast from a super class into sub class. i.e
| can't
| | cast from a type Dog into type Dalmatian
| | b) we have a hierarchy of classes so even if we can get a
| successful
| | cast into a Dalmatian class if we have a collection of FriendsToSniff
| they
| | would need to be cast as well...
| |
| | Another option is to recreate the whole hierarchy, this seems to be an
| | expensive option after all the xmldeserializer has just kinda done all
| this
| | creating.
| |
| | Another other option is use some kind of helper class which we could
use
| to
| | help with the processing, this would be possible but complicated and
| would
| | not support the addition of properties easily as new properties would
| need
| | to be implemented as hashtables inside the helper class or something
like
| | that. Helper classes are good for processing but not properties and
state.
| |
| | So you code hounds and architectural sleuths what do you think??
| |
| | Thanks in advance
| |
| | Mark
| |
| |
| |
| |
| |
| |
| |
|
|
 
S

Sarge

Hi Steven,

thanks for your reply,

we have come to the same conculsion, modifiying the generated source
code is the simplest solution. And yes the partial class idea would be a
neat solution to this issue.

So far it has gone pretty well, we have been manually invoking the code
generation process. This has allowed us to control when and where code is
created, a small amount of file differencing and knowledge about what has
changed still makes this an efficient process.

Regards

Mark (Sarge)


Steven Cheng said:
Hi Sarge,

Have you got any further progress or new ideas on this? If there're
anything else we can help, please feel free to post here.
Also, welcome to sharing any of your good ideas with us.
Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| X-Tomcat-ID: 160503447
| References: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: (e-mail address removed) (Steven Cheng[MSFT])
| Organization: Microsoft
| Date: Tue, 01 Nov 2005 09:49:27 GMT
| Subject: RE: Extending web service proxy classes
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
| Lines: 109
| Path: TK2MSFTNGXA01.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet.webservices:8214
| NNTP-Posting-Host: tomcatimport2.phx.gbl 10.201.218.182
|
| Hi Sarge,
|
| Welcome to Webservice newsgroup.
| As for the question you mentioned, I think it's really a tough question.
| IMO, the best choice should be modify the autogenerated proxy code since
| that's quite direct and convenient. However, since the proxy files are
| autogenerated and our custom code may be override unexpectedly. In .NET
| 2.0, there provide the new partial class which can help separate one
| class's code into mutliple source files. and for those IDE generated
| classes, VS.NET will seprate the IDE generated code from user's custom
code.
|
| Also, as for the downcasting issue you mentioned in the creating derived
| class(from auto generated proxy) means, would you provide some more
detaile
| description? Maybe you can use a simple example to describe the scenario
| you currently meet so that we can get a more visualized concept.
|
| Thanks,
|
| Steven Cheng
| Microsoft Online Support
|
| Get Secure! www.microsoft.com/security
| (This posting is provided "AS IS", with no warranties, and confers no
| rights.)
|
|
| --------------------
| | From: "Sarge" <[email protected]>
| | Subject: Extending web service proxy classes
| | Date: Tue, 1 Nov 2005 09:33:01 +1300
| | Lines: 53
| | X-Priority: 3
| | X-MSMail-Priority: Normal
| | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| | X-RFC2646: Format=Flowed; Original
| | Message-ID: <[email protected]>
| | Newsgroups:
|
microsoft.public.dotnet.framework.aspnet.webservices,microsoft.public.dotnet
| .framework.webservices,microsoft.public.webservices
| | NNTP-Posting-Host: 222-153-144-207.jetstream.xtra.co.nz
222.153.144.207
| | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| | Xref: TK2MSFTNGXA01.phx.gbl
| microsoft.public.dotnet.framework.webservices:8417
| microsoft.public.webservices:1236
| microsoft.public.dotnet.framework.aspnet.webservices:8210
| | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
| |
| | Hi all,
| | tough question. Apologies for the cross posting but it is an
| interesting
| | architectural problem and I think deserves a wide audience.
| |
| | What is the best way to extend web service proxy classes so we can
add
| | our own methods and properties?
| |
| | We have an application that passes a deep hierarchical structure
| (four
| | nodes deep) between a webservice and a smart client.
| | We have built the web service using the Contract First Web Service
| Tool,
| | which essentially builds nice web service proxy classes from a WSDL
and
| xml
| | schemas, nothing new here. This tool uses the xsd.exe generation tool
+
| IDE
| | integration, rather nice.
| | On the client side of the application we need to do some complex /
| semi
| | real time processing on this hierarchy before sending it back.
| |
| | We would like to extend the web service proxy classes without
| modifying
| | the generated class files directly as we know that these things tend
to
| | change and code generation is a big help in this manner.
| |
| | We need properties and methods to be added to the individual web
| service
| | proxy classes
| |
| | Attempts
| | We have tried inheriting from the web service proxy class.
| | This didn't work so well for two reasons
| | a) we can't down cast from a super class into sub class. i.e
| can't
| | cast from a type Dog into type Dalmatian
| | b) we have a hierarchy of classes so even if we can get a
| successful
| | cast into a Dalmatian class if we have a collection of FriendsToSniff
| they
| | would need to be cast as well...
| |
| | Another option is to recreate the whole hierarchy, this seems to be an
| | expensive option after all the xmldeserializer has just kinda done all
| this
| | creating.
| |
| | Another other option is use some kind of helper class which we could
use
| to
| | help with the processing, this would be possible but complicated and
| would
| | not support the addition of properties easily as new properties would
| need
| | to be implemented as hashtables inside the helper class or something
like
| | that. Helper classes are good for processing but not properties and
state.
| |
| | So you code hounds and architectural sleuths what do you think??
| |
| | Thanks in advance
| |
| | Mark
| |
| |
| |
| |
| |
| |
| |
|
|
 
S

Steven Cheng[MSFT]

Thanks for your followup Sarge,

Glad that you've got things working now. Meanwhile, if there're anything
else we can help later, please feel free to post here.
Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)




--------------------
| From: "Sarge" <[email protected]>
| References: <[email protected]>
<[email protected]>
<[email protected]>
| Subject: Re: Extending web service proxy classes
| Date: Mon, 7 Nov 2005 13:04:05 +1300
| Lines: 185
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| X-RFC2646: Format=Flowed; Original
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
| NNTP-Posting-Host: 222-153-144-207.jetstream.xtra.co.nz 222.153.144.207
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet.webservices:8288
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
|
| Hi Steven,
|
| thanks for your reply,
|
| we have come to the same conculsion, modifiying the generated source
| code is the simplest solution. And yes the partial class idea would be a
| neat solution to this issue.
|
| So far it has gone pretty well, we have been manually invoking the code
| generation process. This has allowed us to control when and where code is
| created, a small amount of file differencing and knowledge about what has
| changed still makes this an efficient process.
|
| Regards
|
| Mark (Sarge)
|
|
| | > Hi Sarge,
| >
| > Have you got any further progress or new ideas on this? If there're
| > anything else we can help, please feel free to post here.
| > Also, welcome to sharing any of your good ideas with us.
| > Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| > --------------------
| > | X-Tomcat-ID: 160503447
| > | References: <[email protected]>
| > | MIME-Version: 1.0
| > | Content-Type: text/plain
| > | Content-Transfer-Encoding: 7bit
| > | From: (e-mail address removed) (Steven Cheng[MSFT])
| > | Organization: Microsoft
| > | Date: Tue, 01 Nov 2005 09:49:27 GMT
| > | Subject: RE: Extending web service proxy classes
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
| > | Message-ID: <[email protected]>
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
| > | Lines: 109
| > | Path: TK2MSFTNGXA01.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.aspnet.webservices:8214
| > | NNTP-Posting-Host: tomcatimport2.phx.gbl 10.201.218.182
| > |
| > | Hi Sarge,
| > |
| > | Welcome to Webservice newsgroup.
| > | As for the question you mentioned, I think it's really a tough
question.
| > | IMO, the best choice should be modify the autogenerated proxy code
since
| > | that's quite direct and convenient. However, since the proxy files are
| > | autogenerated and our custom code may be override unexpectedly. In
.NET
| > | 2.0, there provide the new partial class which can help separate one
| > | class's code into mutliple source files. and for those IDE generated
| > | classes, VS.NET will seprate the IDE generated code from user's custom
| > code.
| > |
| > | Also, as for the downcasting issue you mentioned in the creating
derived
| > | class(from auto generated proxy) means, would you provide some more
| > detaile
| > | description? Maybe you can use a simple example to describe the
scenario
| > | you currently meet so that we can get a more visualized concept.
| > |
| > | Thanks,
| > |
| > | Steven Cheng
| > | Microsoft Online Support
| > |
| > | Get Secure! www.microsoft.com/security
| > | (This posting is provided "AS IS", with no warranties, and confers no
| > | rights.)
| > |
| > |
| > | --------------------
| > | | From: "Sarge" <[email protected]>
| > | | Subject: Extending web service proxy classes
| > | | Date: Tue, 1 Nov 2005 09:33:01 +1300
| > | | Lines: 53
| > | | X-Priority: 3
| > | | X-MSMail-Priority: Normal
| > | | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | | X-RFC2646: Format=Flowed; Original
| > | | Message-ID: <[email protected]>
| > | | Newsgroups:
| > |
| >
microsoft.public.dotnet.framework.aspnet.webservices,microsoft.public.dotnet
| > | .framework.webservices,microsoft.public.webservices
| > | | NNTP-Posting-Host: 222-153-144-207.jetstream.xtra.co.nz
| > 222.153.144.207
| > | | Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| > | | Xref: TK2MSFTNGXA01.phx.gbl
| > | microsoft.public.dotnet.framework.webservices:8417
| > | microsoft.public.webservices:1236
| > | microsoft.public.dotnet.framework.aspnet.webservices:8210
| > | | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
| > | |
| > | | Hi all,
| > | | tough question. Apologies for the cross posting but it is an
| > | interesting
| > | | architectural problem and I think deserves a wide audience.
| > | |
| > | | What is the best way to extend web service proxy classes so we
can
| > add
| > | | our own methods and properties?
| > | |
| > | | We have an application that passes a deep hierarchical structure
| > | (four
| > | | nodes deep) between a webservice and a smart client.
| > | | We have built the web service using the Contract First Web
Service
| > | Tool,
| > | | which essentially builds nice web service proxy classes from a WSDL
| > and
| > | xml
| > | | schemas, nothing new here. This tool uses the xsd.exe generation
tool
| > +
| > | IDE
| > | | integration, rather nice.
| > | | On the client side of the application we need to do some
complex /
| > | semi
| > | | real time processing on this hierarchy before sending it back.
| > | |
| > | | We would like to extend the web service proxy classes without
| > | modifying
| > | | the generated class files directly as we know that these things
tend
| > to
| > | | change and code generation is a big help in this manner.
| > | |
| > | | We need properties and methods to be added to the individual web
| > | service
| > | | proxy classes
| > | |
| > | | Attempts
| > | | We have tried inheriting from the web service proxy class.
| > | | This didn't work so well for two reasons
| > | | a) we can't down cast from a super class into sub class. i.e
| > | can't
| > | | cast from a type Dog into type Dalmatian
| > | | b) we have a hierarchy of classes so even if we can get a
| > | successful
| > | | cast into a Dalmatian class if we have a collection of
FriendsToSniff
| > | they
| > | | would need to be cast as well...
| > | |
| > | | Another option is to recreate the whole hierarchy, this seems to be
an
| > | | expensive option after all the xmldeserializer has just kinda done
all
| > | this
| > | | creating.
| > | |
| > | | Another other option is use some kind of helper class which we could
| > use
| > | to
| > | | help with the processing, this would be possible but complicated and
| > | would
| > | | not support the addition of properties easily as new properties
would
| > | need
| > | | to be implemented as hashtables inside the helper class or something
| > like
| > | | that. Helper classes are good for processing but not properties and
| > state.
| > | |
| > | | So you code hounds and architectural sleuths what do you think??
| > | |
| > | | Thanks in advance
| > | |
| > | | Mark
| > | |
| > | |
| > | |
| > | |
| > | |
| > | |
| > | |
| > |
| > |
| >
|
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top