![](/img/trans.png)
[英]operation specified in binding is not defined for 'Porttype', but it is there, wsdl.. help
[英]What's the difference between <binding> and <portType> in WSDL?
<binding>
和<portType>
似乎都定义了一个操作及其消息。 我不太明白,为什么它们都是必要的?
portType (类似于Java接口)
捆绑
SOAP绑定:
SOAP绑定允许使用encoding
或literal
document
或rpc
样式 。 编码指示数据值应如何以XML格式编码(这些规则指定如何将“某事物”编码/序列化为XML,然后将XML解码/反序列化为“某事”)。 Literal意味着数据是根据模式序列化的(这只是普通的XML数据)。 运输类型http,jms,smtp ......
HTTP GET和POST绑定:
WSDL包含HTTP 1.1的GET和POST动词的绑定,以描述Web浏览器和Web站点之间的交互。
MIME绑定: WSDL包含一种将抽象类型绑定到某种MIME格式的具体消息的方法。
在WSDL 2.0中:
有用的链接
接口(wsdl:portType)
WSDL portType元素定义了一组操作(有时称为接口)。
操作元素包含输入和输出元素的组合。 有输出元素时可能有一个fault元素。 这些元素的顺序定义了消息交换模式(MEP)(单向,请求 - 响应等)
WSDL:结合
WSDL绑定元素描述了使用具有给定协议的特定portType的具体细节。
PortType定义Web服务的抽象接口 。
从概念上讲,它就像一个Java接口,因为它定义了一个抽象类型和相关的方法。
在WSDL中,端口类型由绑定和服务元素实现 ,这些元素指示Web服务实现要使用的协议,编码方案等。
即绑定指定具体的实现细节,并实质上将portType映射到一组协议(HTTP和SOAP)消息样式(文档/ RPC)和编码(文字)
这种干扰现在清楚了吗?
端口类型
单个Web服务可以支持许多不同的协议 。 数据结构取决于用于调用Web服务的协议。 因此,您需要一种从操作映射到可以访问它们的端点的方法 。 portType元素负责此映射。
您可以为此Web服务的每个可用协议放置portType定义。 例如,您可以使用SOAP,HTTP-POST和HTTP-GET具有单独的portType定义。 操作名称是Web服务提供的方法。
捆绑
您可以定义最终用户如何绑定到可获取操作的端口。 您可以使用该元素执行此操作。
wsdl:portType与wsdl:operation一起使用,即我们在消息领域和xml中
但wsdl:绑定与soap:binding和soap:操作,即我们在编码,地址,标题和rpc的领域
例如来自: http : //www.w3.org/TR/wsdl#_soap-b
<binding name="StockQuoteSoap" type="tns:StockQuotePortType">
<soap:binding style="document" transport="http://example.com/smtp"/>
<operation name="SubscribeToQuotes">
<input message="tns:SubscribeToQuotes">
<soap:body parts="body" use="literal"/>
<soap:header message="tns:SubscribeToQuotes" part="subscribeheader" use="literal"/>
.....
<binding name="StockQuoteSoapBinding" type="tns:StockQuotePortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="GetTradePrice">
<soap:operation soapAction="http://example.com/GetTradePrice"/>
<input>
<soap:body use="encoded" namespace="http://example.com/stockquote"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
...
关于下级沟通的所有可能细节,从第3.2段开始:
SOAP Binding使用以下扩展元素扩展WSDL:
<definitions .... >
<binding .... >
<soap:binding style="rpc|document" transport="uri">
<operation .... >
<soap:operation soapAction="uri"? style="rpc|document"?>?
<input>
<soap:body parts="nmtokens"? use="literal|encoded"
encodingStyle="uri-list"? namespace="uri"?>
<soap:header message="qname" part="nmtoken" use="literal|encoded"
encodingStyle="uri-list"? namespace="uri"?>*
<soap:headerfault message="qname" part="nmtoken" use="literal|encoded"
encodingStyle="uri-list"? namespace="uri"?/>*
<soap:header>
</input>
<output>
<soap:body parts="nmtokens"? use="literal|encoded"
encodingStyle="uri-list"? namespace="uri"?>
<soap:header message="qname" part="nmtoken" use="literal|encoded"
encodingStyle="uri-list"? namespace="uri"?>*
<soap:headerfault message="qname" part="nmtoken" use="literal|encoded"
encodingStyle="uri-list"? namespace="uri"?/>*
<soap:header>
</output>
<fault>*
<soap:fault name="nmtoken" use="literal|encoded"
encodingStyle="uri-list"? namespace="uri"?>
</fault>
</operation>
</binding>
<port .... >
<soap:address location="uri"/>
</port>
</definitions>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.