Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can you force WCF to use xs:All instead of xs:Sequence so that SOAP element ordering is irrelevant?

Tags:

.net

wcf

How can you make WCF use xs:All instead of xs:Sequence when it defines complex object types in the wsdl/xsd for a web service?

The issue I am having is that xs:Sequence requires that calling applications pass the elements in the soap message in the order specified in the WCF generated xsd (this is alphabetical by default). xs:All (or choice for that matter) does not care about the order.

Can this behaviour be changed simply through a configuration option somewhere?

like image 780
Dean Johnston Avatar asked Sep 30 '09 08:09

Dean Johnston


1 Answers

From the top of my head, I think you can't. What you can do instead, is to write the WSDL file by hand, then use svcutil.exe to generate the code.

If all you want to do is order elements in a different order than alphabetically, you can order the elements in the DataContract, using the Order (starting at 1, not 0 like arrays) parameter on the [DataMember] attribute ([DataMember(Order = 1)], [DataMember(Order = 2)], etc).

like image 103
Philippe Avatar answered Sep 17 '22 23:09

Philippe