When using wsimport, for example
wsimport -J-Djavax.xml.accessExternalSchema=all -keep -verbose https://example.com/path/foo.svc?wsdl
The error I get is
[ERROR] duplicate "message" entity: "..."
line 1 of https://example.com/Path/foo.svc?wsdl
Exception in thread "main" com.sun.tools.internal.ws.wscompile.AbortException
at com.sun.tools.internal.ws.wsdl.framework.AbstractDocument.define(AbstractDocument.java:129)
at com.sun.tools.internal.ws.wsdl.document.Definitions.add(Definitions.java:81)
at com.sun.tools.internal.ws.wsdl.parser.WSDLParser.parseDefinitionsNoImport(WSDLParser.java:278)
at com.sun.tools.internal.ws.wsdl.parser.WSDLParser.processImports(WSDLParser.java:221)
at com.sun.tools.internal.ws.wsdl.parser.WSDLParser.parseDefinitions(WSDLParser.java:210)
at com.sun.tools.internal.ws.wsdl.parser.WSDLParser.buildWSDLDocument(WSDLParser.java:193)
at com.sun.tools.internal.ws.wsdl.parser.WSDLParser.parse(WSDLParser.java:165)
at com.sun.tools.internal.ws.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:120)
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)
What are some reasons why I get this error?
I have a similar problem. My problem is the alpha numeric casing of the url doesn't match the location url in the xml file.
Your https url should point to an xml formatted file. In the xml file, you should have an location attribute.
When using wsimport, make sure the alpha numeric casing matches the url location in the xml file.
For example,
https://example.com/Path/foo.svc?wsdl ---> try https://example.com/path/foo.svc?wsdl
wsimport -keep -verbose https://example.com/path/foo.svc?wsdl