You need to sign in to do that
Don't have an account?
Sushil Agarwal
Error generating Java objects from salesforce API WSDL
I generated enterpise WSDL via Setup > Develop > API. I am getting error while generating java classes and domain objects via the wsimport tool included in the JAX-WS toolkit. It seems to be generating duplicate names in the schema. Can anyone help me fix my environment so it generates a clean wsdl. Is there anyway to select only objects I want to generate because it is a very long WSDL containing all objects which I may not need.
The command I used is:
./wsimport.sh -verbose ../../salesforce.wsdl.xml
The Errors are:
[WARNING] src-resolve: Cannot resolve the name 'tns:ID' to a(n) 'type definition' component.
line 44 of file:/Users/sargawal/Downloads/salesforce.wsdl.xml#types?schema1
[WARNING] Simple type "StatusCode" was not mapped to Enum due to EnumMemberSizeCap limit. Facets count: 274, current limit: 256. You can use customization attribute "typesafeEnumMaxMembers" to extend the limit.
line 15439 of file:/Users/sargawal/Downloads/salesforce.wsdl.xml
[ERROR] A class/interface with the same name "com.sforce.soap.enterprise.DescribeGlobalTheme" is already in use. Use a class customization to resolve this conflict.
line 16052 of file:/Users/sargawal/Downloads/salesforce.wsdl.xml
[ERROR] (Relevant to above error) another "DescribeGlobalTheme" is generated from here.
line 17487 of file:/Users/sargawal/Downloads/salesforce.wsdl.xml
[ERROR] A class/interface with the same name "com.sforce.soap.enterprise.DescribeLayout" is already in use. Use a class customization to resolve this conflict.
line 17615 of file:/Users/sargawal/Downloads/salesforce.wsdl.xml
[ERROR] (Relevant to above error) another "DescribeLayout" is generated from here.
line 16653 of file:/Users/sargawal/Downloads/salesforce.wsdl.xml
[ERROR] A class/interface with the same name "com.sforce.soap.enterprise.DescribeApprovalLayout" is already in use. Use a class customization to resolve this conflict.
line 17684 of file:/Users/sargawal/Downloads/salesforce.wsdl.xml
[ERROR] (Relevant to above error) another "DescribeApprovalLayout" is generated from here.
line 16635 of file:/Users/sargawal/Downloads/salesforce.wsdl.xml
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 16052 of file:/Users/sargawal/Downloads/salesforce.wsdl.xml
[ERROR] (Related to above error) This is the other declaration.
line 17487 of file:/Users/sargawal/Downloads/salesforce.wsdl.xml
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 17615 of file:/Users/sargawal/Downloads/salesforce.wsdl.xml
[ERROR] (Related to above error) This is the other declaration.
line 16653 of file:/Users/sargawal/Downloads/salesforce.wsdl.xml
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 17684 of file:/Users/sargawal/Downloads/salesforce.wsdl.xml
[ERROR] (Related to above error) This is the other declaration.
line 16635 of file:/Users/sargawal/Downloads/salesforce.wsdl.xml
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 15025 of file:/Users/sargawal/Downloads/salesforce.wsdl.xml
[ERROR] (Related to above error) This is the other declaration.
line 15028 of file:/Users/sargawal/Downloads/salesforce.wsdl.xml
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 15029 of file:/Users/sargawal/Downloads/salesforce.wsdl.xml
(ERROR] (Related to above error) This is the other declaration.
line 15026 of file:/Users/sargawal/Downloads/salesforce.wsdl.xml
Exception in thread "main" com.sun.tools.ws.wscompile.AbortException
at com.sun.tools.ws.processor.modeler.wsdl.JAXBModelBuilder.bind(JAXBModelBuilder.java:144)
at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildJAXBModel(WSDLModeler.java:2298)
at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.internalBuildModel(WSDLModeler.java:198)
at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:141)
at com.sun.tools.ws.wscompile.WsimportTool.buildWsdlModel(WsimportTool.java:444)
at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:205)
at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:183)
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:497)
at com.sun.tools.ws.Invoker.invoke(Invoker.java:174)
at com.sun.tools.ws.WsImport.main(WsImport.java:57)
The command I used is:
./wsimport.sh -verbose ../../salesforce.wsdl.xml
The Errors are:
[WARNING] src-resolve: Cannot resolve the name 'tns:ID' to a(n) 'type definition' component.
line 44 of file:/Users/sargawal/Downloads/salesforce.wsdl.xml#types?schema1
[WARNING] Simple type "StatusCode" was not mapped to Enum due to EnumMemberSizeCap limit. Facets count: 274, current limit: 256. You can use customization attribute "typesafeEnumMaxMembers" to extend the limit.
line 15439 of file:/Users/sargawal/Downloads/salesforce.wsdl.xml
[ERROR] A class/interface with the same name "com.sforce.soap.enterprise.DescribeGlobalTheme" is already in use. Use a class customization to resolve this conflict.
line 16052 of file:/Users/sargawal/Downloads/salesforce.wsdl.xml
[ERROR] (Relevant to above error) another "DescribeGlobalTheme" is generated from here.
line 17487 of file:/Users/sargawal/Downloads/salesforce.wsdl.xml
[ERROR] A class/interface with the same name "com.sforce.soap.enterprise.DescribeLayout" is already in use. Use a class customization to resolve this conflict.
line 17615 of file:/Users/sargawal/Downloads/salesforce.wsdl.xml
[ERROR] (Relevant to above error) another "DescribeLayout" is generated from here.
line 16653 of file:/Users/sargawal/Downloads/salesforce.wsdl.xml
[ERROR] A class/interface with the same name "com.sforce.soap.enterprise.DescribeApprovalLayout" is already in use. Use a class customization to resolve this conflict.
line 17684 of file:/Users/sargawal/Downloads/salesforce.wsdl.xml
[ERROR] (Relevant to above error) another "DescribeApprovalLayout" is generated from here.
line 16635 of file:/Users/sargawal/Downloads/salesforce.wsdl.xml
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 16052 of file:/Users/sargawal/Downloads/salesforce.wsdl.xml
[ERROR] (Related to above error) This is the other declaration.
line 17487 of file:/Users/sargawal/Downloads/salesforce.wsdl.xml
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 17615 of file:/Users/sargawal/Downloads/salesforce.wsdl.xml
[ERROR] (Related to above error) This is the other declaration.
line 16653 of file:/Users/sargawal/Downloads/salesforce.wsdl.xml
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 17684 of file:/Users/sargawal/Downloads/salesforce.wsdl.xml
[ERROR] (Related to above error) This is the other declaration.
line 16635 of file:/Users/sargawal/Downloads/salesforce.wsdl.xml
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 15025 of file:/Users/sargawal/Downloads/salesforce.wsdl.xml
[ERROR] (Related to above error) This is the other declaration.
line 15028 of file:/Users/sargawal/Downloads/salesforce.wsdl.xml
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 15029 of file:/Users/sargawal/Downloads/salesforce.wsdl.xml
(ERROR] (Related to above error) This is the other declaration.
line 15026 of file:/Users/sargawal/Downloads/salesforce.wsdl.xml
Exception in thread "main" com.sun.tools.ws.wscompile.AbortException
at com.sun.tools.ws.processor.modeler.wsdl.JAXBModelBuilder.bind(JAXBModelBuilder.java:144)
at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildJAXBModel(WSDLModeler.java:2298)
at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.internalBuildModel(WSDLModeler.java:198)
at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:141)
at com.sun.tools.ws.wscompile.WsimportTool.buildWsdlModel(WsimportTool.java:444)
at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:205)
at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:183)
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:497)
at com.sun.tools.ws.Invoker.invoke(Invoker.java:174)
at com.sun.tools.ws.WsImport.main(WsImport.java:57)
To generate the wsdl, you should use the wsc (web services connector).
More information, see this link:https://developer.salesforce.com/page/Introduction_to_the_Force.com_Web_Services_Connector
If the answer meets their demand, mark it as a solution.
thanks,
Ramon.