I spent hours trying to do some customizations in the wsdl generation, without results.
I got stuck mainly because I could not find a clear sample for what I want to do (I may have missed something).
Let's got to the point : I want to customize the generated WSDL.
The most relevant articles I found are about adding attributes to existing Services to add behavior, like this article.
What I want to do is being able to analyze the OperationContract and generate and additionnal xsd if required.
My questions are :
I don't want to change the way the metadata are consumed by svcutil.exe, just add some ComplexType 'on-the-fly' in the generated wsdl.
Thanks for your suggestions !
What you need is implementing
IWsdlExportExtension.ExportContract but the documentation clearly states:
The ExportContract method is called when the metadata export system is exporting the contract. Only contract and operation behaviors implementing IWsdlExportExtension get the ExportContract call. All behaviors implementing IWsdlExportExtension get the ExportEndpoint call.
For me it means that this method is called only when implemented by contract or operation behavior which is usually defined by custom attribute but you should be also able to assign these behaviors in custom initialization. Here is the example of WSDL extension for endpoint configured from configuration file (configuration offers only behaviors for whole service and endpoints). I believe (but didn't test it) that you can do similar extension which will consist of:
ApplyDispatchBehavioryou will use
serviceEndpoint.Contract.Behaviorsto add contract behavior or
serviceEndpoint.Contract.Operations[x].Behaviorsto add operation behavior.
BehaviorExtensionElementfor defining your new endpoint behavior from configuration file.