第五章 控制 xsi type 属性的使用
2024-07-26 本文已影响0人
Cache技术分享
第五章 控制 xsi:type 属性的使用
控制 xsi:type
属性的使用
默认情况下, SOAP
消息仅包含顶级类型的 xsi:type
属性。例如:
<?xml version="1.0" encoding="UTF-8" ?>
...
<types:GetPersonResponse>
<GetPersonResult href="#id1" />
</types:GetPersonResponse>
<types:Person id="id1" xsi:type="types:Person">
<Name>Yeats,Clint C.</Name>
<DOB>1944-12-04</DOB>
</types:Person>
...
在这些示例中,已添加换行符以提高可读性。要将此属性用于 SOAP
消息中的所有类型,请将 OUTPUTTYPEATTRIBUTE
参数或 OutputTypeAttribute
属性设置为 1
。相同的输出将如下所示:
<?xml version="1.0" encoding="UTF-8" ?>
...
<types:GetPersonResponse>
<GetPersonResult href="#id1" />
</types:GetPersonResponse>
<types:Person id="id1" xsi:type="types:Person">
<Name xsi:type="s:string">Yeats,Clint C.</Name>
<DOB xsi:type="s:date">1944-12-04</DOB>
</types:Person>
...
此参数对 Web
服务的 WSDL
没有影响。
控制编码格式的内联引用的使用
在 Web
服务中,采用编码格式,任何对象值属性都作为引用包含在内,并且引用的对象作为单独的元素写在 SOAP
消息中。
要以内联方式写入编码对象,请将 REFERENCESINLINE
参数或 ReferencesInline
属性指定为 1
。
属性优先于参数。