我一直在阅读WSDL 1.1规范,有一件事情让我觉得很奇怪 - 是什么(除了 WS-I Basic Profile 之外)阻止我这样做:
<message name="helloRequest">
<part name="arg1" type="xs:string" />
</message>
<message name="helloResponse">
<part name="result" type="xs:string" />
</message>
<portType name="Port02">
<operation name="hello">
<input message="tns:helloRequest" name="helloRequest" />
<output message="tns:helloResponse" name="helloResponse" />
</operation>
</portType>
<binding name="Port02SoapBinding" type="tns:Port02">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="hello">
<input name="helloRequest">
<soap:body use="literal" />
</input>
<output name="helloResponse">
<soap:body use="literal" />
</output>
</operation>
</binding>
它是文档/文字 Web 服务,但输入/输出消息包含引用 XSD(简单)类型的部分,而不是全局元素。
WSDL 片段并不那么可怕 - Axis1 和 CXF 都生成具有从部件名称派生的名称的肥皂体元素,但是WSDL 1.1、3.5:soap:body说:
如果 use 是字面量,则每个部分都使用元素或类型属性引用具体的模式定义。在第一种情况下,[...]。在第二种情况下,部件引用的类型成为封闭元素的模式类型(文档样式的 Body或 rpc 样式的部件访问器元素)。
这是否意味着生成的 SOAP 消息(根据 WSDL 规范)看起来像这样(SOAP 正文中的文本内容)?
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:xs="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body xsi:type="xs:string">value</SOAP-ENV:Body>
</SOAP-ENV:Envelope>