Windows Vista Beta | WinVistaBeta.com - Message | behavior attribute for client proxy: WITHOUT ANY CODING???

August 29, 2008  
Subject: behavior attribute for client proxy: WITHOUT ANY CODING???
Group: microsoft.public.windows.developer.winfx.indigo
Date: 2/6/2008 2:54:02 PM
From: =?Utf-8?B?YmVsb2Noa2E=?= [Email Address Protection]

Hi guys,

We have a WCF service accepting requests with custom context object in SOAP
header coming from the client. For this purpose we did the following:

1) On Server Side - applied custom attribute to contract interface (or
service behavior attribute to service class).

2) On Client Side - we ether use app.config to apply custom endpoint
behavior or physically edit generated proxy file and apply custom contract
attribute to proxy interface.

I.e. everything is as MSDN says.

Now, the question is: Is it possible to make client apply the custom
behavior AUTOMATICALLY without any physical app.config modification or
physical coding in generated proxy file? It would be really nice to just
"consume" the service with standard VS2008 "add service reference"
functionality and it would support my custom header object insertion
automatically, without any need of client coding.

I guess there should be something custom in service generated wsdl that
would tell my client to add extra attribute to generated proxy contract
interface ...

I.e. instead of having the following in generated proxy reference:

------ Code Snippet ------
[GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
[ServiceContractAttribute(ConfigurationName="PaymentServiceReference.PaymentService")]
public interface IPaymentService
{
// method prototypes ...
}
-----------------------------

I want to have something like:

------ Code Snippet ------
[GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
[ServiceContractAttribute(ConfigurationName="PaymentServiceReference.PaymentService")]
[InsertCustomContextContractBehaviorAttribute] // <--- this one is required
!!!
public interface IPaymentService
{
// method prototypes ...
}
-----------------------------

with extra attribute.

Does anyone know how i can achieve this? May be there is a way to
automatically generate something in app.config instead of applying custom
attribute?

Thanks,
Belochka.



Back