我想提供一个接口给我在wsdl文件中定义的一些复杂类型。我尝试了以下操作,结果为:XPath evaluation of "wsdl:definitions" results in empty target node
这是我的binding.xml文件:
<jaxb:bindings node="wsdl:definitions/wsdl:types">
<jaxb:bindings node="xs:complexType[@name='test']">
<inheritance:implements>com.package.Interface</inheritance:implements>
</jaxb:bindings>
</jaxb:bindings>
</jaxb:bindings>
我通过maven cxf-codegen-plugin生成Java文件:
<wsdlOption>
<wsdl>src/main/resources/wsdl/Service.wsdl</wsdl>
<frontEnd>jaxws21</frontEnd>
<bindingFiles>
<bindingFile>src/main/resources/wsdl/binding.xml</bindingFile>
</bindingFiles>
</wsdlOption>
所以我不知道是否必须将wsdl文件作为模式导入,因此我尝试将其添加到binding.xml中,如下所示:
<jaxb:bindings schemaLocation="wsdl/Service#type2">
...
</jaxb:bindings>
结果是:
"file:/home/xxx/xxx/src/src/main/resources/wsdl/Service#type2" is not a part of this compilation. Is this a mistake for .,../binding.xml"
说实话,我不知道是否需要将wsdl作为schemaLocation以及如何精确地引用它。
wsdl的某些部分:
<?xml version="1.0" encoding="utf-8"?><wsdl:definitions name="Service" targetNamespace="http://xxx/Service" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" >
....
<wsdl:types>
<xs:schema elementFormDefault="qualified" targetNamespace="http://zzzz/201/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://zzzzz/201/">
<xs:complexType name="test">
请让我知道是否需要其他信息,谢谢!