[英]What makes wsdl file with portType but without binding correct?
在wsdl 手册中 ,在示例2的第二部分中,有一个wsdl文件具有portType
,但没有binding
块
<?xml version="1.0"?>
<definitions
targetNamespace="http://example.com/stockquote/definitions"
xmlns:tns="http://example.com/stockquote/definitions"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<import namespace="some.xsd"
location="some.xsd"/>
<message name="GetLastTradePriceInput">
<part name="body"/>
</message>
<message name="GetLastTradePriceOutput">
<part name="body"/>
</message>
<portType name="StockQuotePortType">
<operation name="GetLastTradePrice">
<input message="tns:GetLastTradePriceInput"/>
<output message="tns:GetLastTradePriceOutput"/>
</operation>
</portType>
</definitions>
some.xsd
是同一个例子的第1部分,也没有绑定。
当我尝试通过cxf
的wsdltojava
传递该文件时,它会给我一个警告
WARNING: WSDL document file:/C:/IdeaProjects/sss/webservices/src/main/schema/BundleAdmin/Atry.wsdl does not define any services
和一个错误:
WSI-BP-1.0 R2718 violation: A wsdl:binding in a DESCRIPTION MUST have the same set of wsdl:operations as the wsdl:portType to which it refers. GetLastTradePrice not found in wsdl:binding.
这些是wsdltojava
使用的参数:
List<String> prepareArgs = ['-fe', 'jaxws',
'-autoNameResolution',
'-db', 'jaxb',
'-xjc-extension',
'-impl', '-server', '-client', '-validate',
'-d', ext.genDirName,
/* change package name for types already generated with XmlBeans */
'-p', 'http://messaging.ei.tmobile.net/datatypes=net.tmobile.ei.messaging.jaxb'
请问,是什么让翻译程序要求binding
部分? -validate可以使SW注意到问题,但不是创建问题的arg。
...引用外部XSD的正确方法是在wsdl:types元素中使用带有import / include的XSD架构。
有关详细信息,请参阅
在你的情况下,你正在使用
*<import namespace="some.xsd"
location="some.xsd"/>*
在引用的链接之后,为什么不在<types>
元素中包含<import namespace=...
元素,如下所示:
哦,这完全是我的错误。 wsdl手册的示例2的第二部分实际上只有portType而没有绑定。 它导入的xsd文件也没有绑定(当然)。 但第二部分不是服务! 该服务是第三部分,具有绑定和导入部分2.因此,该服务具有portType和绑定。 它们不是要求binding
部分的参数 ,它总是需要它。
我应该注意警告 - 提到的文件还不是服务,应该存在另一个文件,它将是一个服务,并将包含该文件的包含和绑定部分。 或者,当然,它可以在一个文件中包含portType
和binding
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.