tags:

views:

53

answers:

1

Hi All,

I am looking for adding a version number to the wsdl that gets created for a WCF service. Let me know whether it is a good practice to add the version number as a part of data contract or at the soap headers? if so how to do it? This version number would be helpful to find out the latest wsdl.

Thanks & Regards, Priya.R

A: 

Just how exactly (or rather, where) do you expect to add that information? If it's just informative to make it easier to diagnose issues (i.e. it doesn't affect how the WSDL would be used or the code generated) then it should be possible to do so by implementing a custom IWsdlExportExtension. Here's an older sample implementation I wrote a while ago that might give you an idea of how it's used.

tomasr
Thanks Tomasr. Actually I need to set and get the version values. I need to consume it even from non .Net client say like from java.
priya
So how exactly do you want to consume that version information in the clients? When generating code from the WSDL?I bring this up because WSDL is normally only used in dev, it's not something you really use at runtime, so I'm somewhat confused as to how you'd used it.Unless, perhaps, you mean that version information to end up being embedded, somehow, into the messages that client and server exchange, somehow, in which case tweaking the WSDL isn't going to do the trick anyway and you need to change your messaging itself.
tomasr
Actually we are creating WSDL at runtime for a particular group of ppl. We want the version information to be created while creating wsdl. If a person is using a version lower than the version of the wsdl that belongs to his group, he should be downloading the new wsdl again. This is our requirement.
priya
OK, I still don't get it why exactly you want to consume the WSDL at runtime or just how you plan to enforce people get it again, if all you have is a version number in the WSDL file itself. In any case, there's really no standard way to add it, so you're pretty much stuck using a custom attribute somewhere and adding tooling on both ends to produce/consume it (Not sure how easy that will be on the java side, though).
tomasr