SoapOption 枚举


指定与 SoapTypeAttribute 类一起使用的 SOAP 配置选项。Specifies the SOAP configuration options for use with the SoapTypeAttribute class.

此枚举有一个 FlagsAttribute 属性,允许按位组合成员值。

此 API 支持产品基础结构,不能在代码中直接使用。

public enum class SoapOption
public enum SoapOption
public enum SoapOption
type SoapOption = 
Public Enum SoapOption


AlwaysIncludeTypes 1

指示类型将总是包含在 SOAP 元素上。Indicates that type will always be included on SOAP elements. 当使用对所有元素都要求类型的 SOAP 实现执行 SOAP Interop 时,该选项很有用。This option is useful when performing SOAP interop with SOAP implementations that require types on all elements.

EmbedAll 4

指示将不使用引用而生成 SOAP。Indicates that SOAP will be generated without references. 目前未实现此选项。This option is currently not implemented.

None 0

指示未选定额外选项的默认选项。The default option indicating that no extra options are selected.

Option1 8

临时互操作条件的公共保留选项;其用途将会改变。Public reserved option for temporary interop conditions; the use will change.

Option2 16

临时互操作条件的公共保留选项;其用途将会改变。Public reserved option for temporary interop conditions; the use will change.

XsdString 2

指示 SOAP 封装中的输出 SOAP 字符串类型使用的是 XSD 前缀,并且生成的 XML 不具有该字符串的 ID 属性。Indicates that the output SOAP string type in a SOAP Envelope uses the XSD prefix, and that the resulting XML does not have an ID attribute for the string.


SoapOption枚举用于指定 .NET Framework 如何生成 SOAP 的指令。The SoapOption enumeration is used to specify instructions to the .NET Framework on how it will generate the SOAP.

例如, 默认情况下, 类 (包含SoapOptions.None枚举值) 可能以 SOAP 格式远程处理, 如下所示:For example, while a class by default (with the SoapOptions.None enumeration value) might be remoted in the SOAP format as:

<member2 id="ref-3">hello</member2>  
<member3 href="#ref-3"/>  
<member4 href="#ref-4"/>  
<member4shared href="#ref-4"/>  
<member5 href="#ref-5"/>  
<member6 id="ref-6" xsi:type="SOAP-ENC:string">Hello World</member6>  
<str1 id="ref-7">hello &#60; world</str1>  
<str2 id="ref-8">&#60;</str2>  
<str3 id="ref-9">&#60; world</str3>  
<str4 href="#ref-7"/>  

带有SoapOptions.XsdString选项的远程处理序列化将生成以下 XML:Remoting serialization with the SoapOptions.XsdString option produces the following XML:

<member1 xsi:type="xsd:int">10</member1>  
<member2 xsi:type="xsd:string">hello</member2>  
<member3 xsi:type="xsd:string">hello</member3>  
<member4 href="#ref-3"/>  
<member4shared href="#ref-3"/>  
<member5 href="#ref-4"/>  
<member6 xsi:type="xsd:string">Hello World</member6>  
<str1 xsi:type="xsd:string">hello &#60; world</str1>  
<str2 xsi:type="xsd:string">&#60;</str2>  
<str3 xsi:type="xsd:string">&#60; world</str3>  
<str4 xsi:type="xsd:string">hello &#60; world</str4>  

有关 SOAP 信封的详细信息, 请参阅 more information about SOAP envelopes, see