1

环境 :

JAX-WS 地铁 2.2.8

雄猫 6

JAX-WS Maven 插件 2.3

日蚀朱诺

问题 :

我无法使用带有外部绑定文件的 jax-ws maven 插件生成客户端工件。

下面是我的 binding.xml 文件:

<?xml version="1.0" encoding="UTF-8"?>

<bindings
  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
  wsdlLocation="http://localhost:8080/jaxws/userOperationsService?wsdl"
  xmlns="http://java.sun.com/xml/ns/jaxws"
  schemaLocation="http://localhost:8080/jaxws/userOperationsService?xsd=1">

  <!-- applies to wsdl:definitions node, that would mean the entire wsdl -->
  <enableAsyncMapping>false</enableAsyncMapping>

  <!-- wsdl:portType operation customization -->
  <bindings node="wsdl:definitions/wsdl:portType [@name='userOperations']/wsdl:operation[@name='getUserDevices']">
      <enableAsyncMapping>true</enableAsyncMapping>
  </bindings>
</bindings>

我得到的错误是:

[ERROR] XPath evaluation of "wsdl:definitions/wsdl:portType [@name='userOperations']/wsdl:operation[@name='getUserDevices']" results in an empty target node
  line 13 of file:/F:/study/jaxws-async/src/main/resources/jaxws/binding/binding.xml

[WARNING] unknown extensibility element or attribute "ns1" (in namespace "http://www.w3.org/2000/xmlns/")
  line 21 of http://localhost:8080/jaxws/userOperationsService?wsdl=1

[WARNING] unknown extensibility element or attribute "ns2" (in namespace "http://www.w3.org/2000/xmlns/")
  line 22 of http://localhost:8080/jaxws/userOperationsService?wsdl=1

[WARNING] unknown extensibility element or attribute "ns3" (in namespace "http://www.w3.org/2000/xmlns/")
  line 25 of http://localhost:8080/jaxws/userOperationsService?wsdl=1

[WARNING] unknown extensibility element or attribute "ns4" (in namespace "http://www.w3.org/2000/xmlns/")
  line 26 of http://localhost:8080/jaxws/userOperationsService?wsdl=1
Failed to parse the WSDL.

查看下面生成的 WSDL 是导致问题的元素:

<portType name="userOperations">
<operation name="getUserDetails">
<input xmlns:ns1="http://www.w3.org/2007/05/addressing/metadata" ns1:Action="http://com.atul.userOps/userOperations/getUserDetails" message="tns:getUserDetails"/>
<output xmlns:ns2="http://www.w3.org/2007/05/addressing/metadata" ns2:Action="http://com.atul.userOps/userOperations/userOperations/getUserDetailsResponse" message="tns:getUserDetailsResponse"/>
</operation>
<operation name="getUserDevices">
<input xmlns:ns3="http://www.w3.org/2007/05/addressing/metadata" ns3:Action="http://com.atul.userOps/userOperations/getUserDevices" message="tns:getUserDevices"/>
<output xmlns:ns4="http://www.w3.org/2007/05/addressing/metadata" ns4:Action="http://com.atul.userOps/userOperations/userOperations/getUserDevicesResponse" message="tns:getUserDevicesResponse"/>
</operation>
</portType>

为什么 wsimport 无法识别 xmlns:ns1 命名空间?

有什么办法可以摆脱这个吗?

web服务的war文件部署在tomcat上。请帮忙。

4

0 回答 0