Menu

Wsdl versioning strategy

4 Comments

wsdl versioning strategy

This article illustrates several aspects of WCF Data Contract versioning and the practices adopted for providing backward compatibility to contracts. Once the service is developed and rolled over to production, any changes in contracts should be backward compatible so that existing clients are not affected when changes are deployed. In the previous article WCF Backwards Compatibility and Versioning Strategies — Part 1 I explored the effects of changes in a Service Contract in different scenarios. Modification in a WCF service can happen in Data Contracts. The WCF service has a strategy method UpdateEmployeeData which returns a type EmpInfo with updated employee information. Strategy WCF service has a single method UpdateEmployeeData which has a parameter and return type of the user defined type EmpInfo. Click on Discover or type the service URL in the Address box. Once you click on OKthe stub code will be generated. Now call the service in the console application using the following code:. There is an Wsdl property for data members whose default value is false. If the property is set to true for any data member, WCF tells the serialization engine that the value must be presented in the underlying XML. Since we have not mentioned the property, the default value false has been considered. Modify the Data Contract EmpInfo. Add a non—required member EmpAddress. Now run the existing consumer client console application without updating the service reference. We want to call the service using the old stub code. You should get the following output:. An exception is supposed to occur as follows:. As we have added a required Data Member EmpCityWCF expects the value of EmpCity must be present while a message is being traversed from the client to the service. Since we are not providing the value of the required member EmpCity from the client, the application encounters an error. Update the service reference and run the client. The client should successfully run. Change the client code in order to send the value for the updated members EmpAddress and EmpCity:. Now strategy the service in order to remove wsdl non-required member EmpAddress. In this case, the service is unable to return the full dataset back to the client. The value sent for the member EmpAddress gets lost at the service end. An exception is supposed to be occurred as follows:. So, in this case, an exception is thrown when the client receives responses from the service with missing values. While modifying Data Contracts, there could be a case where the types of individual Data Members are modified. Now run the client. Since we have modified primitive types from int to string the client might versioning successfully and produce the desired output. The client sends the EmpID value as int which is then converted to a string at the service end. But in most cases, if types are compatible, no exception is thrown but unexpected results might be received. It is understood that the newly added Data Member has been serialized and passed over versioning wire. Only the EmpInfo class in our old stub code has not been modified to include the new member EmpAddress. The client ignores the newly added members when processing the message, but it resends that same data, including the newly added members, back to the versionNew service. This is called versioning round-trip. The typical scenario for this is data updates where data is retrieved from the service, changed, and returned. When the WCF Framework encounters data that is not part of the original data contract, the versioning is stored in the property and preserved. It is not processed in any other way except for temporary storage. If the object is returned back to where it originated, the original unknown data is also returned. Therefore the data has made a round trip to and from the originating endpoint without loss. To enable round-trip for a particular type, the type must implement the IExtensibleDataObject interface. The interface contains one property, ExtensionData that returns the ExtensionDataObject type. The property is used to store any data from future versions of the data contract that is unknown to the current version. The svcutil tool generated stub code also implements the Data Contract classes from the IExtensibleDataObject interface. In the Visual Studio IDE, explore the service reference and open the stub code in the file Reference. You can see that the Data Contract class EmpInfo implements IExtensibleDataObject:. The ExtensionDataObject strategy contains no public methods or properties. Thus, it is impossible to get direct access to the data stored inside the ExtensionData property. Although it can viewed in the debugger:. In order to prevent data loss at service Case -3we can implement IExtensibleDataObject at the versioning as well. To achieve this, we can derive Data Contracts from the IExtensibleDataObject interface:. Modify the client code in order to send unknown Data Members. The EmpInfo stub code should have an additional Data Member EmpAddress which is unknown to the server. Also, the IExtensibleDataObject behavior can wsdl the service from potential DoS attacks. This is done in code so by setting the IgnoreExtensionDataObject property of ServiceBehaviorAttribute to trueas shown below:. Now, debug the service and you will see that additional members in ExtensionData are displayed as null in the debugger:. It is recommended that all your types implement this interface to accommodate new and unknown future members. This way the WCF data contract system can evolve over time in non-breaking ways and provide Data Contract forward compatibility. I have tried to discuss some possible cases of versioning of operations in Data Contracts. In the next and last part of the article, I will explore versioning strategies supported by the WCF framework in different cases. This article, along with any associated source code and files, is licensed under The Code Project Open License CPOL. Articles Quick Answers Messages. WCF Backward Compatibility and Versioning Strategies — Part 2. Nag13 Mar Please Sign up or sign in to vote. Download source code - Backward compatibility across Data Contracts Modification in a WCF service can happen in Data Contracts. The Data Contract EmpInfo is as follows: Develop a console application in order to test the service. Now call the service in the console application using the following code: WriteLine " Employee ID: WriteLine " Employee Name: The following output should be generated: Adding Add new non-required members There is an IsRequired property for wsdl members whose default value is false. We have set the value for the newly added member. You should get the following output: Adding new required members Modify the Data Contract EmpInfo. Versioning a wsdl member EmpCity: An exception is supposed to occur as follows: Remove non-required members Update the service reference and run the client. Change the client code in order to send the value for the updated members EmpAddress and EmpCity: An exception is supposed to be occurred as follows: Modify existing member data types While modifying Data Contracts, there could be a case where the types of individual Data Members are modified. Strategy can see versioning the Data Contract class EmpInfo implements IExtensibleDataObject: Although it can viewed in the debugger: To achieve this, we can derive Data Contracts from the IExtensibleDataObject interface: WriteLine " Employee Address: Modify the service implementation as follows: This wsdl done in code so by setting the IgnoreExtensionDataObject property of ServiceBehaviorAttribute to trueas shown below: Now, debug the service and you will see that additional members in ExtensionData are displayed as null in the debugger: WCF Backwards Compatibility and Versioning Strategies — Part 1. Generate and add keyword variations using Strategy API. WCF Backward Compatibility and Versioning Strategies — Part 3. Window Tabs WndTabs Add-In for DevStudio. SAPrefs - Netscape-like Preferences Dialog. WTL for MFC Programmers, Part IX - GDI Classes, Common Dialogs, and Utility Classes. You must Sign In to use this message board. Tridip Bhattacharjee Feb Amey K Bhatkar Aug 3: Michael Freidgeim Jul S V Saichandra Sep 1: Permalink Advertise Privacy Terms of Use Mobile Web02 2. Article Copyright by Kausik J. Article Browse Code Stats Revisions 3 Alternatives Comments 8 Add your own strategy version Tagged as C Dev WCF Intermediate Stats WCF Backward Compatibility and Versioning Strategies — Part 2 Kausik J. How to backward compatible Service Contract Tridip Bhattacharjee Feb Developer have to create WCF service for Order processing, with following function: Ok, our customers need another functions: DeleteOrderById, GetOrdersByCustomerId and don't need GetOrdersByStatus any more, we need GetOrdersByStatusAndCustomerId Developers have to wsdl ServiceContrcat and update client. As you can see, any changes in the ServiceContrcat is really difficult so i am looking for best guidance how to develop wcf service which will not create any problem if we extend the functionality or any kind of change but client end will not face any problem. Strategy vote 4 Amey K Bhatkar Aug 3: I have same question that other having How IExtensibleDataObject prevent dos attack? My vote of 2 Michael Freidgeim Jul IExtensibleDataObject increases risk from potential DoS attacks Michael Freidgeim Jul The statement " the IExtensibleDataObject behavior can protect the service from potential DoS attacks" is incorrect. Please wsdl test output in case 3 Versioning Freidgeim Jul There is a typo in output Console. EmpCity ; Should be Console. EmpCity ; Versioning also replace corresponding images Michael Freidgeim. My vote of 5 S V Saichandra Sep 1: IExtensionDataObject Support in Silverllight bachuwarmahendar Jun 1: Kausik, Thanks for Providing a Solution. I Have Similar kind of Implementation But in WCF Service i am using Silverlight Class library in which Runtime Serialization is Not having IExtensionDataObject to Implement. Can you provide a solution for Same with Silverlight Class Library. IExtensionDataObject Support in Silverllight Kausik J. Hi, I afraid, the Silverlight Framework classes does not have IExtensionDataObject. In that cases you can manually develop a collection implementing Reflexion and might use the same at Silverlight end.

Web Services Versioning

Web Services Versioning

4 thoughts on “Wsdl versioning strategy”

  1. Alecs says:

    Altogether, the completed seasons and side-stories total 2,176,431 words. note.

  2. Òèãðàí says:

    This past weekend we played in SoCal and our roster had 11 players and 1 sub.

  3. .::V.K.L::. says:

    Brave New World and Brave New World Revisited (First Perennial Classics ed.). New York: HarperCollins Publishers.

  4. anafroncomo says:

    Do not attempt to research and write a seminar in just a few days.

Leave a Reply

Your email address will not be published. Required fields are marked *

inserted by FC2 system