![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | behavior attribute for client proxy: WITHOUT ANY CODING??? 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. |
My System Specs![]() |
| | #2 (permalink) |
| | RE: behavior attribute for client proxy: WITHOUT ANY CODING??? Yes, there is. Look add the behavior in <system.serviceModel> <behaviors> <endpointBehaviors> <behavior> <customBehavior /> </behavior> </endpointBehaviors> </behaviors> <extensions> <add name="customBehavior" type="..." /> </extensions> </system.serviceModel> You will need a class that inherits from BehaviorExtensionElement and that is the type registered in the extensions element... Hope this helps, Carlos "belochka" wrote: Quote: > 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. > > |
My System Specs![]() |
| | #3 (permalink) |
| | RE: behavior attribute for client proxy: WITHOUT ANY CODING??? Well, this is not really what i meant ![]() The problem is not to configure server side to use the custom behavior. What i want is that SERVER behavior config (or attribute) would be somehow picked up by the CLIENT during client proxy class generation. So, i dont want to write any code or modify config on CLIENT side. I want to implement custom behavior on the WCF service class or interface (using attribute), then on client side "add server reference" in VS2008 and it should be smart enough to somehow recognize custom attribute for my WCF service class or interface and apply THE SAME attribute to the client proxy AUTOMATICALLY (as long as i reference the same dll on the client, of course). One of the suggestions I got from MSFT guys on MSDN forum is to customize WSDL generation/consumption using IWsdlImporter. If there is no better choice, i'll have to try doing it this way. "blackbelt" wrote: Quote: > Yes, there is. Look add the behavior in > > <system.serviceModel> > <behaviors> > <endpointBehaviors> > <behavior> > <customBehavior /> > </behavior> > </endpointBehaviors> > </behaviors> > <extensions> > <add name="customBehavior" type="..." /> > </extensions> > </system.serviceModel> > > You will need a class that inherits from BehaviorExtensionElement and that > is the type registered in the extensions element... > > Hope this helps, > > Carlos > > "belochka" wrote: > Quote: > > 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. > > > > |
My System Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Vista client under squid proxy | Vista networking & sharing | |||