Служба SOAP работает нормально в пользовательском интерфейсе SOAP, но когда я анализирую WSDL, при вызове напрямую по URL-адресу или из classpath, выдается два исключения.Я пробовал с 2 плагинами Maven cxf-codegen-plugin
и maven-jaxb2-plugin
, но исключения те же.Мне любопытно, как тот же API работает на интерфейсе SOAP, а не в коде Java ...
Исключения:
unbounded prefix 'SOAP-ENV'
Unexpected <xsd:element> appears
Ниже перечислены конфигурации обоих плагинов
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.14.0</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<strict>false</strict>
<schemaLanguage>WSDL</schemaLanguage>
<schemaDirectory>${project.basedir}/src/main/resources/wsdl</schemaDirectory>
<generatePackage>com.soaptesting.product.wsdl</generatePackage>
<generateDirectory>${project.basedir}/src/main/java</generateDirectory>
<schemas>
<schema>
<url>${project.basedir}/src/main/resources/wsdl/service.wsdl</url>
</schema>
</schemas>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>3.3.1</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${project.build.directory}/generated-sources/cxf</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${project.basedir}/src/main/resources/wsdl/products.wsdl</wsdl>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
Вот трассировка стека при компиляции проекта с плагином maven-jaxb2
ERROR] URI [/soaptesting/src/main/resources/wsdl/products.wsdl] does not provide the scheme part.
[ERROR] Could not resolve the last modification of the URI [/soaptesting/src/main/resources/wsdl/products.wsdl] with the scheme [null].
[WARNING] Last modification of the URI [/soaptesting/src/main/resources/wsdl/products.wsdl] is not known.
[INFO] Sources are not up-to-date, XJC will be executed.
[ERROR] Error while parsing schema(s).Location [ file:/soaptesting/src/main/resources/wsdl/products.wsdl{421,43}].
org.xml.sax.SAXParseException: unbounded prefix 'SOAP-ENV'
at com.sun.xml.xsom.impl.parser.ParserContext$1.reportError (ParserContext.java:180)
at com.sun.xml.xsom.impl.parser.NGCCRuntimeEx.reportError (NGCCRuntimeEx.java:179)
at com.sun.xml.xsom.impl.parser.NGCCRuntimeEx.reportError (NGCCRuntimeEx.java:182)
at com.sun.xml.xsom.impl.parser.NGCCRuntimeEx.parseUName (NGCCRuntimeEx.java:530)
at com.sun.xml.xsom.impl.parser.state.qname.leaveAttribute (qname.java:135)
at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.consumeAttribute (NGCCRuntime.java:348)
at com.sun.xml.xsom.impl.parser.state.particle.text (particle.java:777)
at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.sendText (NGCCRuntime.java:438)
at com.sun.xml.xsom.impl.parser.state.NGCCHandler.revertToParentFromText (NGCCHandler.java:185)
at com.sun.xml.xsom.impl.parser.state.occurs.text (occurs.java:290)
at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.sendText (NGCCRuntime.java:438)
at com.sun.xml.xsom.impl.parser.state.occurs.text (occurs.java:284)
at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.sendText (NGCCRuntime.java:438)
at com.sun.xml.xsom.impl.parser.state.occurs.text (occurs.java:308)
at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.sendText (NGCCRuntime.java:438)
at com.sun.xml.xsom.impl.parser.state.NGCCHandler.spawnChildFromText (NGCCHandler.java:138)
at com.sun.xml.xsom.impl.parser.state.particle.text (particle.java:878)
at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.processPendingText (NGCCRuntime.java:241)
at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.endElement (NGCCRuntime.java:317)
at org.xml.sax.helpers.XMLFilterImpl.endElement (XMLFilterImpl.java:570)
at com.sun.tools.xjc.reader.internalizer.DOMForestScanner$LocationResolver.endElement (DOMForestScanner.java:140)
at com.sun.xml.bind.unmarshaller.DOMScanner.visit (DOMScanner.java:255)
at com.sun.xml.bind.unmarshaller.DOMScanner.visit (DOMScanner.java:281)
at com.sun.xml.bind.unmarshaller.DOMScanner.visit (DOMScanner.java:250)
at com.sun.xml.bind.unmarshaller.DOMScanner.visit (DOMScanner.java:281)
at com.sun.xml.bind.unmarshaller.DOMScanner.visit (DOMScanner.java:250)
at com.sun.xml.bind.unmarshaller.DOMScanner.visit (DOMScanner.java:281)
at com.sun.xml.bind.unmarshaller.DOMScanner.visit (DOMScanner.java:250)
at com.sun.xml.bind.unmarshaller.DOMScanner.visit (DOMScanner.java:281)
at com.sun.xml.bind.unmarshaller.DOMScanner.visit (DOMScanner.java:250)
at com.sun.xml.bind.unmarshaller.DOMScanner.visit (DOMScanner.java:281)
at com.sun.xml.bind.unmarshaller.DOMScanner.visit (DOMScanner.java:250)
at com.sun.xml.bind.unmarshaller.DOMScanner.scan (DOMScanner.java:127)
at com.sun.tools.xjc.reader.internalizer.DOMForestScanner.scan (DOMForestScanner.java:92)
at com.sun.tools.xjc.ModelLoader.loadWSDL (ModelLoader.java:392)
at com.sun.tools.xjc.ModelLoader.load (ModelLoader.java:158)
at com.sun.tools.xjc.ModelLoader.load (ModelLoader.java:117)
at org.jvnet.mjiip.v_2_3.XJC23Mojo.loadModel (XJC23Mojo.java:50)
at org.jvnet.mjiip.v_2_3.XJC23Mojo.doExecute (XJC23Mojo.java:40)
at org.jvnet.mjiip.v_2_3.XJC23Mojo.doExecute (XJC23Mojo.java:28)
at org.jvnet.jaxb2.maven2.RawXJC2Mojo.doExecute (RawXJC2Mojo.java:478)
at org.jvnet.jaxb2.maven2.RawXJC2Mojo.execute (RawXJC2Mojo.java:320)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
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 org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
[ERROR] Error while parsing schema(s).Location [ file:/soaptesting/src/main/resources/wsdl/products.wsdl{425,30}].
org.xml.sax.SAXParseException: Unexpected <xsd:element> appears at line 425 column 30
at com.sun.xml.xsom.impl.parser.NGCCRuntimeEx.unexpectedX (NGCCRuntimeEx.java:632)
at com.sun.xml.xsom.impl.parser.state.NGCCHandler.unexpectedEnterElement (NGCCHandler.java:195)
at com.sun.xml.xsom.impl.parser.state.complexType.enterElement (complexType.java:655)
at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.sendEnterElement (NGCCRuntime.java:422)
at com.sun.xml.xsom.impl.parser.state.NGCCHandler.revertToParentFromEnterElement (NGCCHandler.java:151)
at com.sun.xml.xsom.impl.parser.state.complexType_complexContent_body.enterElement (complexType_complexContent_body.java:108)
at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.sendEnterElement (NGCCRuntime.java:422)
at com.sun.xml.xsom.impl.parser.state.NGCCHandler.revertToParentFromEnterElement (NGCCHandler.java:151)
at com.sun.xml.xsom.impl.parser.state.attributeUses.enterElement (attributeUses.java:323)
at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.sendEnterElement (NGCCRuntime.java:422)
at com.sun.xml.xsom.impl.parser.state.attributeUses.enterElement (attributeUses.java:182)
at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.sendEnterElement (NGCCRuntime.java:422)
at com.sun.xml.xsom.impl.parser.state.attributeUses.enterElement (attributeUses.java:293)
at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.sendEnterElement (NGCCRuntime.java:422)
at com.sun.xml.xsom.impl.parser.state.NGCCHandler.spawnChildFromEnterElement (NGCCHandler.java:114)
at com.sun.xml.xsom.impl.parser.state.complexType_complexContent_body.enterElement (complexType_complexContent_body.java:102)
at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.sendEnterElement (NGCCRuntime.java:422)
at com.sun.xml.xsom.impl.parser.state.NGCCHandler.revertToParentFromEnterElement (NGCCHandler.java:151)
at com.sun.xml.xsom.impl.parser.state.particle.enterElement (particle.java:217)
at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.startElement (NGCCRuntime.java:263)
at org.xml.sax.helpers.XMLFilterImpl.startElement (XMLFilterImpl.java:551)
at com.sun.tools.xjc.reader.internalizer.DOMForestScanner$LocationResolver.startElement (DOMForestScanner.java:147)
at com.sun.xml.bind.unmarshaller.DOMScanner.visit (DOMScanner.java:244)
at com.sun.xml.bind.unmarshaller.DOMScanner.visit (DOMScanner.java:281)
at com.sun.xml.bind.unmarshaller.DOMScanner.visit (DOMScanner.java:250)
at com.sun.xml.bind.unmarshaller.DOMScanner.visit (DOMScanner.java:281)
at com.sun.xml.bind.unmarshaller.DOMScanner.visit (DOMScanner.java:250)
at com.sun.xml.bind.unmarshaller.DOMScanner.scan (DOMScanner.java:127)
at com.sun.tools.xjc.reader.internalizer.DOMForestScanner.scan (DOMForestScanner.java:92)
at com.sun.tools.xjc.ModelLoader.loadWSDL (ModelLoader.java:392)
at com.sun.tools.xjc.ModelLoader.load (ModelLoader.java:158)
at com.sun.tools.xjc.ModelLoader.load (ModelLoader.java:117)
at org.jvnet.mjiip.v_2_3.XJC23Mojo.loadModel (XJC23Mojo.java:50)
at org.jvnet.mjiip.v_2_3.XJC23Mojo.doExecute (XJC23Mojo.java:40)
at org.jvnet.mjiip.v_2_3.XJC23Mojo.doExecute (XJC23Mojo.java:28)
at org.jvnet.jaxb2.maven2.RawXJC2Mojo.doExecute (RawXJC2Mojo.java:478)
at org.jvnet.jaxb2.maven2.RawXJC2Mojo.execute (RawXJC2Mojo.java:320)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
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 org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
ниже приводится трассировка стека путем анализа WSDL из wsimport
parsing WSDL...
[WARNING] s4s-elt-invalid-content.1: The content of 'responseAwards' is invalid. Element 'element' is invalid, misplaced, or occurs too often.
line 418 of file:/productssoapapi/src/main/resources/wsdl/products.wsdl#types?schema1
[ERROR] unbounded prefix 'SOAP-ENV'
line 421 of file:/productssoapapi/src/main/resources/wsdl/products.wsdl
[ERROR] Unexpected <xsd:element> appears at line 425 column 30
line 425 of file:/productssoapapi/src/main/resources/wsdl/products.wsdl
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)