我需要在Eclipse IDE中生成客户端代理java文件。
我试图通过wsimport命令生成这个。以下是我使用的命令。
wsimport -keep -b bindings.xml -p com.aasc.carrier.shipexec.proxy -implServiceName wcfSoxContract -implPortName wcfShip http://shipexec.com/demo/wcf/soap?wsdl -B-XautoNameResolution
执行此操作后,我遇到了问题。
[ERROR]无效操作“InstantiateWCF”,无法生成java方法参数。全局元素“{......} InstantiateWCF”中包装子“package”的本地名称是java关键字。使用自定义更改参数名称。 http://shipexec.com/demo/wcf/soap?wsdl=wsdl0
的第1行我尝试使用自定义绑定xml文件解决此问题,如下所示。
<?xml version="1.0" encoding="UTF-8"?>
<jaxws:bindings xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
wsdlLocation="http://shipexec.com/demo/wcf/soap?wsdl">
<enableWrapperStyle>false</enableWrapperStyle>
<jaxws:bindings node="wsdl:definitions/wsdl:import/wsdl:portType[@name='IwcfShip']/wsdl:operation[@name='InstantiateWCF']">
<jaxws:parameter part="wsdl:definitions/wsdl:message[@name='IwcfShip_InstantiateWCF_InputMessage']/wsdl:part[@name='parameters']" childElementName="package" name="paramPackage" />
</jaxws:bindings>
</jaxws:bindings>
但是我想要获得的节点无法识别。
任何人都可以帮助找到更改“InstantiateWCF”操作参数名称的确切节点路径。
谢谢, Y Pradeep
答案 0 :(得分:0)
我已将binding.xml文件更改为以下内容解决了此问题。
<?xml version="1.0" encoding="UTF-8"?>
<jaxws:bindings xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
wsdlLocation="http://shipexec.com/demo/wcf/soap?wsdl=wsdl0">
<jaxws:bindings node="wsdl:definitions" >
<jaxws:bindings node="//wsdl:portType[@name='IwcfShip']/wsdl:operation[@name='InstantiateWCF']">
<jaxws:parameter part="wsdl:definitions/wsdl:message[@name='IwcfShip_InstantiateWCF_InputMessage']/wsdl:part[@name='parameters']" childElementName="tns:package" name="paramPackage" />
</jaxws:bindings>
</jaxws:bindings>
</jaxws:bindings>
还修改了wsimport命令,如下所示。
wsimport -keep -p com.aasc.carrier.shipexec.proxy -implServiceName wcfSoxContract -implPortName wcfShip http://shipexec.com/demo/wcf/soap?wsdl -B-XautoNameResolution -b bindings.xml
谢谢, Y Pradeep