WCF LOB 适配器 SDK 生成的 WSDL 包含每个 portType 的其他描述性信息。 本主题介绍了此附加信息的架构。
文档 XML 架构
使用注释 portType 来实现操作文档,并添加表示适配器文档的节点。 此节点包含进一步描述作和参数的子节点。 此架构的定义如下。
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="adapterOperationDocumentation">
<xs:complexType>
<xs:sequence>
<xs:element name="summary" type="xs:string" />
<xs:element maxOccurs="unbounded" name="param">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="name" type="xs:string" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="returns" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
为给定作生成 WSDL 时,前面的架构用于以人工可读格式提供其他描述性信息。 例如,以下 portType 信息是为 Echo 适配器的 EchoString 操作返回的。
<wsdl:portType name="EchoService">
<wsdl:operation name="EchoString">
<wsdl:documentation>
<doc:adapterOperationDocumentation>
<doc:summary>String EchoString( string aName)\</doc:summary>
<doc:param name="aName">This string will be echoed back to the user.\</doc:param>
<doc:returns>String value containing the value of aName \</doc:returns>
</doc:adapterOperationDocumentation>
</wsdl:documentation>
<wsdl:input wsaw:Action="Echo/EchoString" message="ns2:EchoService_EchoString_InputMessage" />
<wsdl:output wsaw:Action="Echo/EchoString/response" message="ns2:EchoService_EchoString_OutputMessage" />
</wsdl:operation>
</wsdl:portType>
文档元素的值是从Microsoft.ServiceModel.Channels.Common.ParameterizedOperationMetadata获取的,与操作有关。 前面的示例是由以下示例生成的结果。
ParameterizedOperationMetadata om = new ParameterizedOperationMetadata(operationId, operationId);
// set this if you want this operation to belong to this interface name
// in the generated proxy, the interface name will be EchoService
// and the client implementation name will be EchoServiceClient.
om.OperationGroup = "EchoService";
// set the operation namespace to be same as service namespace
om.OperationNamespace = EchoAdapter.SERVICENAMESPACE;
switch (operationId)
{
case "Echo/EchoString":
om.DisplayName = "EchoString";
om.OriginalName = "targetSystemEchoString";
om.Description = "String EchoString( string aName)";
OperationParameter parm1 = new OperationParameter("aName", OperationParameterDirection.In, QualifiedType.StringType, false);
parm1.Description = "This string will be echoed back to the user.";
OperationResult result = new OperationResult(new SimpleQualifiedType(XmlTypeCode.String), false);
result.Description = "String value containing the value of aName";
om.Parameters.Add(parm1);
om.OperationResult = result;
return om;