I am new to Java. I am trying to create SOAP Web service client to consume a vendors webservice which requires username password and ssl certificate.
A vendor provided me SoapUI project file. I imported the project file in SoapUI and ran the tests. Those tests worked successfully.
I then exported the wsdl file using SoapUI and tried to generate java code using wsimport. I am unable to generate code. I am getting all sorts of errors which I tried to resolve by searching online but none of the solutions work.
I am using jdk1.8.0_152. and SoapUI version 5.3.0 by SmartBear.
I tried to use this wsimport command on command line of Windows 7:
wsimport -keep -verbose -s src vendor.wsdl
and I received this message:
[WARNING] Simple type "RiskType" was not mapped to Enum due to EnumMemberSizeCap limit. Facets count: 365, current limit: 256. You can use customization attribute "typesafeEnumMaxMembers" to extend the limit.
line 4317 of file:/C:/Projects/soapclient/vendor.xsd
With the SoapUI Project file they also sent me the below files:
- jaxbbinding.xml
- wsdlbinding.xml
- ACORD_v2.2.0.xsd
- ACORD-WSP_v2.0.0.xsd
- Soap12-Envelope.xsd
- xml.xsd
So tried wsimport with -b option like below:
wsimport -keep -verbose -s src vendor.wsdl -b ../jaxb/jaxbbinding.xml -b ../jaxb/wsdlbinding.xml
I received this error :
[ERROR] "file:/C:/Projects/soapclient/.../ACORD_v2.2.0.xsd" is not a part of this compilation. Is this a mistake for "file:/C:/Projects/soapclient/..../ProcessSuretyBond_1_2.xsd"?
line 13 of file:/C:/Projects/TestProjects/soapclient/..../jaxb/jaxbbinding.xml
Exception in thread "main" com.sun.tools.internal.ws.wscompile.AbortException
at com.sun.tools.internal.ws.processor.modeler.wsdl.JAXBModelBuilder.bind(JAXBModelBuilder.java:129)
at com.sun.tools.internal.ws.processor.modeler.wsdl.WSDLModeler.buildJAXBModel(WSDLModeler.java:2283)
at com.sun.tools.internal.ws.processor.modeler.wsdl.WSDLModeler.internalBuildModel(WSDLModeler.java:183)
at com.sun.tools.internal.ws.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:126)
at com.sun.tools.internal.ws.wscompile.WsimportTool.buildWsdlModel(WsimportTool.java:429)
at com.sun.tools.internal.ws.wscompile.WsimportTool.run(WsimportTool.java:190)
at com.sun.tools.internal.ws.wscompile.WsimportTool.run(WsimportTool.java:168)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.tools.internal.ws.Invoker.invoke(Invoker.java:159)
at com.sun.tools.internal.ws.WsImport.main(WsImport.java:42)
Not sure but should I request new binding files from the vendor ?
It works in SoapUI so shouldn't it work with wsimport ?
I tried all solution out there to resolve this issue including creating jaxb.properties file in jdk folder, adding jvm argument in maven's system settings etc. None worked.
I will appreciate if someone can point me in right direction and help resolve this issue. Many thanks in advance.
Try this:
wsimport ./vendor.wsdl -Xnocompile -d ./src -extension -keep -XadditionalHeaders -B-XautoNameResolution
You don’t need to use the binding files from your vendor. You will need the last 4 files you received from your vendor to make the above command work.