How to make a dotnet webservice set minOccurs=quot;1quot; on a string value(如何使 dotnet webservice 设置 minOccurs=“1;在字符串值上)
问题描述
我有一个 XSD:
我使用 XSD.exe v2.0.50727.3615 将其转换为 C# 类,生成代码如下
Which I have converted into a C# class using XSD.exe v2.0.50727.3615 which generates code as follows
我在我的网络服务中返回了一个 A.A 对象,它在服务描述中生成了这个片段
I am returning an A.A object in my webservice, which produces this snippet in the service description
从 XSD 中的 minOccrus="1" 到自动生成的 WSDL 中的 minOccurs="0" 的变化正在给系统另一端的机器带来麻烦.
The change from minOccrus="1" in the XSD to minOccurs="0" on the auto-generated WSDL is causing grief to the machine on the other end of the system.
我当然可以提供手动编辑的 WSDL 供他们使用,但我希望自动生成的 WSDL 能够满足他们的需求.
I could of course provide a hand edited WSDL for them to use, but I would like the auto-generated one to suit their needs.
关于如何说服 dotnet 在其自动生成的 WSDL 中为字符串类型输出 minOccurs="1" 而不添加 nillable="true" 的任何建议?
Any suggestions on how to convince dotnet to output minOccurs="1" for a string type in its autogenerated WSDLs without also adding nillable="true"?
推荐答案
我注意到下面一行:
对于将 XML Schema 复杂类型与非 XML 特定的类绑定,.NET Framework 不提供等效于 minOccurs 或 maxOccurs 属性的直接编程语言.
For binding XML Schema complex types with non-XML-specific classes, the .NET Framework does not provide a direct programming language equivalent to the minOccurs or maxOccurs attribute.
从这里:http://msdn.microsoft.com/en-us/library/zds0b35c(v=vs.85).aspx
这篇关于如何使 dotnet webservice 设置 minOccurs=“1";在字符串值上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!