Web 服务扩展文件
本部分概述了 Web 服务扩展文件。
WSX 文件 (WCF 服务扩展) 是扩展文件,允许应用程序操作不影响线路数据表示的本地行为。 我们可以在将来添加新功能而不会破坏互操作性,这应该是可扩展的。
WSX 的整体结构将模拟 XSD 或 WSDL 文件的结构,该文件是一个 XML 文件,它与main输入文件保持相同的结构。 main 文件中同一命名令牌上的额外属性将指定应用程序希望控制默认行为的属性。
我们在 M3 中可能不会执行任何操作。 在 V1 中,我可以看到我们支持以下属性:
用法 指定计数参数/参数字段。
这是一个元素属性,但仅适用于数组类型。 IsCountOf 属性指定数组元素。 计数字段/参数不显示在网络上。
<xs:schema xmlns:tns="http://Example.org" elementFormDefault="qualified"
targetNamespace="http://Example.org" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<element name="FooInParam">
<complexType>
<!-- MyArray field is presented in WSDL file as an element -->
<element name="MyArrayCount" IsCountOf="MyArray"></element>
</complexType>
</element>
</xs:schema>
为自定义类型指定读/写回调
这些属性强制wsutil.exe为指定类型生成 WS_CUSTOM_TYPE 。 custom_readcallback 属性指定 读取回调 例程,custom_writecallback指定 写入回调 例程。
<xs:schema xmlns:tns="http://Example.org" elementFormDefault="qualified"
targetNamespace="http://Example.org" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<element name="mytype" custom_readcallback="myreadcallback" custom_writecallback="mywritecallback">
</element>
</xs:schema>
我们可以有一个匹配的 WSX 文件来描述其本地行为:
<xs:schema xmlns:tns="http://Example.org" elementFormDefault="qualified"
targetNamespace="http://Example.org" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<element name="FooInParam" DataValidationRoutine="MyArrayValidation">
<complexType>
<element name="MyLocalArrayCount" IsCountOf="MyArray"></element>
</complexType>
</element>
</xs:schema>
WsUtil.exe为结构生成以下原型:
typedef struct FooInParam
{
ULONG MyLocalArrayCount;
int * MyArray;
};
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈