在WDSL中生成重复名称时,Apache CXF wsdl2java

时间:2017-06-27 18:08:18

标签: java cxf wsdl2java

我需要从轴wsdl2java客户端生成一个web服务客户端。当我执行命令时:

wsdl2java -frontend jaxws21 -p "net.imaginary.project.ws.client" -d "D:\dev\TestClient\src" -encoding utf-8 -client https://serviceshomologa.serasaexperian.com.br/RelatoProxy?wsdl

它在日志输出上生成以下错误:

Suppressed: org.apache.cxf.tools.common.ToolException: https://servicesh
omologa.serasaexperian.com.br/RelatoProxy?xsd=xsd4 [0,0]: (Relevante para o erro
 acima) outro "ConsultarRelatoRequestType" foi gerado daqui.
                ... 7 more

这意味着当它尝试生成ConsultarRelatoRequestType类时,它是重复的。

我的网络服务端点是:

https://serviceshomologa.serasaexperian.com.br/RelatoProxy?wsdl

CXF文档说我需要创建一个绑定文件,我这样做了:

<bindings
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    wsdlLocation="RelatoProxy.wsdl"
    xmlns="http://java.sun.com/xml/ns/jaxws">
    <bindings node="wsdl:definitions/wsdl:portType:[@name='ConsultarRelatoRequestType']">
    <class name="ConsultarRelatoRequestType2"/>
    </bindings>
</bindings>

然而,当我跑步时,结果是:

WSDLToJava Error: Could not find any node with the XPath expression: //wsdl:defi
nitions/wsdl:portType:[@name='ConsultarRelatoRequestType']

因为[ConsultarRelatoRequestType]在xsd内而不是wsdl

0 个答案:

没有答案