支持绑定附件:WSDL 示例
使用此任务查看带 Web Services-Interoperability (WS-I) Attachments Profile V1.0 编码和带附件的 SOAP 消息编码的 WSDL 片段的示例。
关于此任务
Web Services-Interoperability (WS-I) Attachments Profile V1.0
定义了有关为绑定附件构造“内容标识”的约定。此约定对消息部分名称进行了编码。因此,无论 SOAP 主体是否包含用来表示该消息部分的元素,服务集成技术都可以识别绑定附件。关于构造“内容标识”的约定如下所示:
name=uuid@domain
其中 name 是进行编码的消息部分的名称,uuid 是一个全局唯一标识,domain 是域标识(例如,my.example.com)。注: 这种方法与“带有附件的 SOAP 消息”编码方案不同,后者不会定义关于“内容标识”的约定,但是它将使用 SOAP 主体中的元素来指示消息部分被编码为附件。
为了便于区分各种情况,服务集成技术假定:如果消息附件遵循有关构造“内容标识”的 V1.0 约定,那么消息是 V1.0 消息。
示例
以下 WSDL 片段适用于绑定附件,带有遵循两种样式的消息实例:
<wsdl:binding name="BoundSoapBinding" type="intf:BoundPortType">
<soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="bound">
<soap:operation soapAction=""/>
<wsdl:input>
<mime:multipartRelated>
<mime:part>
<soap:body parts="stringIn" namespace="http://bound"
use="literal"/>
</mime:part>
<mime:part>
<mime:content part="attachIn" type="text/xml"/>
</mime:part>
</mime:multipartRelated>
</wsdl:input>
以下 WSDL 片段适用于使用 V1.0 编码的 SOAP 实例。在此片段中,消息体中不包含 attachIn 部分,并且附件的“内容标识”标识被编码的部分。
--myBoundary
Content-Type: text/xml
Content-Transfer-Encoding: 7bit
Content-Id: <myStartID>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<ns0:bound xmlns:ns0="http://bound">
<stringIn>some string data</stringIn>
</ns0:bound>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
--myBoundary
Content-Type: text/xml
Content-Transfer-Encoding: 7bit
Content-Id: <attachIn=someUUID@some.domain.name>
<someOtherXMLElement/>
--myBoundary--
以下 WSDL 片段适用于使用带有附件的 SOAP 消息编码的 SOAP 实例。在此片段中,消息体中包含对绑定附件的引用,并且附件的“内容标识”不受约束。
--myBoundary
Content-Type: text/xml
Content-Transfer-Encoding: 7bit
Content-Id: <myStartID>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<ns0:bound xmlns:ns0="http://bound">
<stringIn>some string data</stringIn>
<attachIn href="cid:notTheStart"/>
</ns0:bound>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
--myBoundary
Content-Type: text/xml
Content-Transfer-Encoding: 7bit
Content-Id: <notTheStart>
<someOtherXMLElement/>
--myBoundary--
在前两种情况下,消息中有足够的信息来标识绑定附件,并且在这两种情况下,服务集成技术都将绑定附件条目放置在附件列表中,并将附件中的数据放置到数据图的主体部分。