Description
wsdl2java does not find imports, that have been made to the default namespace.
Error:
wsdl2java -verbose -d ./target getaccount.wsdl
wsdl2java - Apache CXF 3.1.2
Sep 07, 2015 10:19:22 AM org.apache.cxf.wsdl11.WSDLServiceBuilder checkForWrapped
INFO: Operation
GetAccount cannot be unwrapped, input message must reference global element declaration with same localname as operation
WSDLToJava Error: file:/Volumes/Data/opt/projects/res-cxf/types.xsd [11,8]: undefined simple type 'Money'
org.apache.cxf.tools.common.ToolException: file:/Volumes/Data/opt/projects/res-cxf/types.xsd [11,8]: undefined simple type 'Money'
at org.apache.cxf.tools.common.ToolErrorListener.throwToolException(ToolErrorListener.java:87)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:166)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:415)
at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103)
at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:113)
at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:86)
at org.apache.cxf.tools.wsdlto.WSDLToJava.main(WSDLToJava.java:184)
Caused by: org.xml.sax.SAXParseException; systemId: file:/Volumes/Data/opt/projects/res-cxf/types.xsd; lineNumber: 11; columnNumber: 8; undefined simple type 'Money'
at com.sun.xml.xsom.impl.parser.ParserContext$1.reportError(ParserContext.java:180)
at com.sun.xml.xsom.impl.parser.NGCCRuntimeEx.reportError(NGCCRuntimeEx.java:175)
at com.sun.xml.xsom.impl.parser.DelayedRef.resolve(DelayedRef.java:110)
at com.sun.xml.xsom.impl.parser.DelayedRef.run(DelayedRef.java:85)
at com.sun.xml.xsom.impl.parser.ParserContext.getResult(ParserContext.java:135)
at com.sun.xml.xsom.parser.XSOMParser.getResult(XSOMParser.java:214)
at com.sun.tools.xjc.ModelLoader.createXSOM(ModelLoader.java:538)
at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:269)
at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:95)
at org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:460)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.generateTypes(WSDLToJavaContainer.java:726)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:270)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:164)
... 5 more
Doing the same thing with the std. wsimport works perfectly well.
(please see attached example for reproduction).
Based on the XML Schema Spec, this should work:
The <import> element information item identifies namespaces used in external references, i.e. those whose - QName- identifies them as coming from a different namespace (or none) than the enclosing schema document's targetNamespace. The - actual value- of its namespace [attribute] indicates that the containing schema document may contain qualified references to schema components in that namespace (via one or more prefixes declared with namespace declarations in the normal way). If that attribute is absent, then the import allows unqualified reference to components with no target namespace. Note that components to be imported need not be in the form of a - schema document- ; the processor is free to access or construct components using means of its own choosing.
Any thoughts for you side on this?
Thank you very much,
Alex