wsimport 绑定命名空间错误
wsimport bindings namespace error
我正在尝试为某些名称space更改包名称space,因为它们有碰撞的对象。
这是 wsdl:
<wsdl:definitions
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://tempuri.org/"
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="https://localhost/DS/Search.svc?xsd=xsd0" namespace="http://tempuri.org/"/>
<xsd:import schemaLocation="https://localhost/DS/Search.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
</xsd:schema>
</wsdl:types>
</wsdl:definitions>
绑定如下:
<?xml version="1.0" encoding="UTF-8"?>
<jaxb:bindings xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
jaxb:version="2.0"
wsdlLocation="https://localhost/DS/Search.svc?wsdl">
<jaxb:bindings node="//wsdl:definitions/wsdl:types/xsd:schema/xsd:import[@namespace='http://tempuri.org/']">
<jaxb:schemaBindings>
<jaxb:package name="directoryservice"/>
</jaxb:schemaBindings>
</jaxb:bindings>
<jaxb:bindings node="//wsdl:definitions/wsdl:types/xsd:schema/xsd:import[@namespace='http://localhost.datacontract.org/2004/07/Search.Models.SearchAPI']">
<jaxb:schemaBindings>
<jaxb:package name="directoryservice.model"/>
</jaxb:schemaBindings>
</jaxb:bindings>
</jaxb:bindings>
当我使用 -b 选项 运行 wsimport 时出现此错误
[ERROR] XPath evaluation of "//wsdl:definitions/wsdl:types/xsd:schema/xsd:import[@namespace='http://tempuri.org/']" results in empty target node
line 7 of file:service-bindings.xml
我收到两个绑定的错误..
我是否遗漏了绑定定义的某些内容?
我通过使用全局绑定找到了解决这个问题的方法。绑定将创建服务 ObjectFactory 但不会创建模型 pojos。
<?xml version="1.0" encoding="UTF-8"?>
<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
jaxb:version="2.0">
<jaxb:globalBindings generateElementProperty="false"/>
</jaxb:bindings>
我正在尝试为某些名称space更改包名称space,因为它们有碰撞的对象。
这是 wsdl:
<wsdl:definitions
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://tempuri.org/"
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="https://localhost/DS/Search.svc?xsd=xsd0" namespace="http://tempuri.org/"/>
<xsd:import schemaLocation="https://localhost/DS/Search.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
</xsd:schema>
</wsdl:types>
</wsdl:definitions>
绑定如下:
<?xml version="1.0" encoding="UTF-8"?>
<jaxb:bindings xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
jaxb:version="2.0"
wsdlLocation="https://localhost/DS/Search.svc?wsdl">
<jaxb:bindings node="//wsdl:definitions/wsdl:types/xsd:schema/xsd:import[@namespace='http://tempuri.org/']">
<jaxb:schemaBindings>
<jaxb:package name="directoryservice"/>
</jaxb:schemaBindings>
</jaxb:bindings>
<jaxb:bindings node="//wsdl:definitions/wsdl:types/xsd:schema/xsd:import[@namespace='http://localhost.datacontract.org/2004/07/Search.Models.SearchAPI']">
<jaxb:schemaBindings>
<jaxb:package name="directoryservice.model"/>
</jaxb:schemaBindings>
</jaxb:bindings>
</jaxb:bindings>
当我使用 -b 选项 运行 wsimport 时出现此错误
[ERROR] XPath evaluation of "//wsdl:definitions/wsdl:types/xsd:schema/xsd:import[@namespace='http://tempuri.org/']" results in empty target node
line 7 of file:service-bindings.xml
我收到两个绑定的错误..
我是否遗漏了绑定定义的某些内容?
我通过使用全局绑定找到了解决这个问题的方法。绑定将创建服务 ObjectFactory 但不会创建模型 pojos。
<?xml version="1.0" encoding="UTF-8"?>
<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
jaxb:version="2.0">
<jaxb:globalBindings generateElementProperty="false"/>
</jaxb:bindings>