简体   繁体   中英

Creating custom binding for generating wsdl client proxy using wsimport

I have a requirement to generate client proxy java files in Eclipse IDE.

I tried to generate this via wsimport command. Below is the command I used.

wsimport -keep -b bindings.xml -p com.aasc.carrier.shipexec.proxy -implServiceName wcfSoxContract -implPortName wcfShip http://shipexec.com/demo/wcf/soap?wsdl -B-XautoNameResolution

After executing this I am getting below issue.

[ERROR] Invalid operation "InstantiateWCF", can't generate java method parameter. Local name of the wrapper child "package" in the global element "{......}InstantiateWCF" is a java keyword. Use customization to change the parametername. line 1 of http://shipexec.com/demo/wcf/soap?wsdl=wsdl0

I tried to resolve this issue using the custom binding xml file as below.

<?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>

But the node I am trying to get is not recognizing.

Can anyone please help on finding the exact node path for changing the name of the parameter for 'InstantiateWCF' operation.

Thanks, Y Pradeep

I have resolved this issue by changing binding.xml file to as below.

<?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>

And also modified wsimport command as below.

wsimport -keep -p com.aasc.carrier.shipexec.proxy -implServiceName wcfSoxContract -implPortName wcfShip http://shipexec.com/demo/wcf/soap?wsdl -B-XautoNameResolution -b bindings.xml

Thanks, Y Pradeep

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM