Even if you can force WCF to do this, the deserializer will not work correctly to support input. Examples and explanations below.
Input 1 (good):
<MyOperation> <AField>value A</AField> <BField>value B</BField> </MyOperation>
Input 2 (bad):
<MyOperation> <BField>value B</BField> <AField>value A</AField> </MyOperation>
So, if input 1 is deserialized correctly, then input 2 will not - BField would have the value that was set, but the AField property would be null.
If WCF cannot handle this input out of sequence, I strongly believe that it should throw an exception, but based on my testing (.NET 3.5 in IIS) it does not, it just skips some element values.
In addition, WCF also ignores completely dummy input if it does not affect the valid values ββof the elements it searches. So this entry
<MyOperation> <bogusField>with or without data</bogusField> <AField>value A</AField> <bogusField2 /> <BField>value B</BField> <bogusField3></bogusField3> </MyOperation>
will not cause any errors and actually deserializes the values ββin AField and BField.
Abacus
source share