你怎么能强制WCF使用的xs:XS,而不是所有的:序列使SOAP元素顺序是无关紧要的?有的、你怎么、无关紧要、序列

由网友(゜痞子╮英雄)分享简介:如何让WCF使用的xs:不是所有的xs:序时,它定义了复杂的对象类型的WSDL / XSD的Web服务How can you make WCF use xs:All instead of xs:Sequence when it defines complex object types in the wsdl/xsd...

如何让WCF使用的xs:不是所有的xs:序时,它定义了复杂的对象类型的WSDL / XSD的Web服务

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?

我遇到的问题是,XS:序列需要调用应用程序传递的SOAP消息中的元素在WCF指定的顺序生成的XSD(这是按字母顺序默认情况下)。 XS:所有(或选择为此事)不关心的顺序

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?

推荐答案

从我的头顶,我认为你不能。你可以做什么,而不是,是手工编写WSDL文件,然后使用svcutil.exe的生成code。

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.

如果你想要做的是在不同的顺序按字母顺序,你可以订购的DataContract元素顺序的元素,使用顺序(从1开始,而不是0喜欢阵列)上的[数据成员]属性参数([数据成员(ORDER = 1)],[数据成员(顺序= 2)],等等)。

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).

阅读全文

相关推荐

最新文章