Reputation: 33
I have a WCF service. I generate proxy code using a svcutil like
svcutil.exe <wsdl & xsd files> /serializer:XmlSerializer /targetClientVersion:Version35 /namespace:*,<namespace> /noconfig /out:GeneratedProxy.cs
and distribute the GeneratedProxy.cs
proxy file, as well as the wsdl & xsd files to partners that use my service. They then use my proxy in their client applications to consume my service.
I am looking for a way to add versioning info (something very simple like YYYY-MM format) to the generated proxy file, so that when client applications call into my service using the provided GeneratedProxy.cs
file, I have visibility on which proxy, that I provided, they are using on the server side (preferably through headers). I want clients to be unaware of all this -- they use the provided GeneratedProxy.cs
file and the versioning info is automatically sent to the server.
I looked into using IClientMessageInspector
but that doesn't solve my problem. It requires my partners to make modifications to their client applications to register the wcf "behavior". And I would have to depend on them to correctly populate the http headers.
(It is also acceptable to me if the versioning info is based on the current xsd data contract and wsdl file)
Upvotes: 0
Views: 293
Reputation: 1330
The proxy that you provide to your clients is just a proxy. They don't have to use it to access your service, they can create their own class to call it.
This means you can't know how they call your service.
You can ask for additional parameters in the request, like "callingApplication" or "proxyVersion" to be passed by the caller, but the truth of the values is not guaranteed...
(+) And a side note: Proxy should not be updated frequently. You need to plan and design your service, in terms of requests and responses, and ideally generate the Proxy once, then updating the implementations should not affect the request / response structures
Upvotes: 0