Ошибка пространства имен привязок wsimport

Я пытаюсь изменить пространство имен пакета для некоторых пространств имен, потому что у них есть объекты, которые сталкиваются.

Вот 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>

Когда я запускаю wsimport с опцией -b, я получаю эту ошибку

[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

Я получаю ошибку для обеих привязок..

Я что-то упустил с определением привязок?

1 ответ

Решение

Я нашел способ обойти эту проблему с помощью глобальной привязки. Привязка создаст Serivce 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>
Другие вопросы по тегам