none
Data Contract Design - Country/Currency Codes RRS feed

  • Question

  • Hi,

    we have a strongly typed web service with the ISO Alpha 2 Country codes list (from 2009) as an enumeration, along with Currency codes (the version of this eludes me right now).

    We have a bit of a dilemma in that some Countries have been added to the ISO Alpha 2 Country codes list since we ingrained the Country codes from 2009 into the WCF Data Contract...along with the currency codes.

    Has anyone come across a solution on how to handle such changes to data, like Country codes/currency codes which our outside of our control. Or is the only solution to update the data contract and issue it to clients (not quite as easy to do in my circumstances).

    Thanks in advance.


    Tryst

    Monday, April 8, 2013 3:03 PM

Answers

  • Hi,

    I am not sure if I properly get your issue, if you mean it needs some changes for the service contract but the service contract cannot be modified once published, if so you can use contract inheritance. Define a new service contract interface that inherits from the old service contract interface, then add methods to the new interface. You then change the service that implements the old contract to implement the new contract and change the "versionOld" endpoint definition to use the new contract. To "versionOld" clients, the endpoint will continue to appear as exposing the "versionOld" contract; to "versionNew" clients, the endpoint will appear to expose the "versionNew" contract.

    #Service Versioning

    http://msdn.microsoft.com/en-us/library/ms731060.aspx

    Hope this helps.

    Best Regards.


    Haixia
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, April 9, 2013 7:27 AM
    Moderator

All replies

  • Hi,

    I am not sure if I properly get your issue, if you mean it needs some changes for the service contract but the service contract cannot be modified once published, if so you can use contract inheritance. Define a new service contract interface that inherits from the old service contract interface, then add methods to the new interface. You then change the service that implements the old contract to implement the new contract and change the "versionOld" endpoint definition to use the new contract. To "versionOld" clients, the endpoint will continue to appear as exposing the "versionOld" contract; to "versionNew" clients, the endpoint will appear to expose the "versionNew" contract.

    #Service Versioning

    http://msdn.microsoft.com/en-us/library/ms731060.aspx

    Hope this helps.

    Best Regards.


    Haixia
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, April 9, 2013 7:27 AM
    Moderator
  • Thanks, for your reply, Haixia. I will run this by my developers and respond here.

    We currently version our WCF service by using a version number in the URL.../1.0/ (is version 1.0), /1.1/ (is version 1.1 etc).

    Does this attached link you provide not match/suit our current versioning model?

    Thanks


    Tryst

    Tuesday, April 16, 2013 6:22 PM
  • Hi,

    If the address changes for your service, it is a breaking change unless clients are capable of dynamically discovering the new endpoint address or binding. You can "using a Universal Discovery Description and Integration (UDDI) registry and the UDDI Invocation Pattern where a client attempts to communicate with an endpoint and, upon failure, queries a well-known UDDI registry for the current endpoint metadata" as suggested in this document.

    Best Regards.


    Haixia
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, April 17, 2013 10:05 AM
    Moderator
  • Hi Haixia,

    yes, the reason we have a new URL (1.x) is because the data/service contract has changed somewhat, so you could say we 'break' the existing contract. That is why we change a new version (change the URL) because it allows clients who integrated against older version will not have anything broken and can continue to use the old versions. The newer contract versions are for clients who wish to upgrade to the newer versions (to get exposure to the new functionality) or for all new customers to come on board.

    You have to remember that we broadcast our web service to live customers, and not internal systems. So organizing a coordinated release roll out is not possible.

    So going back to my initial problem, we have a version of our service on /1.0/ which uses a currency set which is now out of date, so most clients who have generated service proxies will have now been tightly binded to the out data currency enumeration in the service contract. I needed to know if I can update this currency enumeration on version /1.0/ or whether such a change can only be done on a new version/URL (/1.1/) so that current customers/clients on /1.0/ can remain unaffected...but would still be using the outdated currency enumeration in the data contract.

    Thanks


    Tryst

    Wednesday, April 17, 2013 11:42 AM
  • Hi,

    >>I needed to know if I can update this currency enumeration on version /1.0/ or whether such a change can only be done on a new version/URL (/1.1/) so that current customers/clients on /1.0/ can remain unaffected

    If the contract, address, binding and implementation of the service for the old clients are not changed, the oldClient will not be affected, otherwise, they will be affected, so that you need a different version for the clients.

    Best Regards.


    Haixia
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, April 18, 2013 10:32 AM
    Moderator