One important element in building a good SOA(Service Oriented Architecture) is creating a good versioning approach. If you fail to get good versioning from the start, It will become really hard to fix it afterwards.
So therefore remember the first rule of versioning web services:
“One object in, One object out”
What does it mean?
Let’s explain with the following sample. Imagine I created a webservice with the following method:
This is a hard to version service and a really bad example. Why? Because we are using a simple type as input(in this case a guid). This means that in this case we have one object out, but not one object in. If later we have to add a second input parameter, we’ll end up with a breaking change.
A better alternative is to use the following contract:
Now we have one object in, one object out. If we want to send some extra data, we can just add it to the OrderRequest object as an extra property.