wsdl2java генерирует код из wsdl с разными пространствами имен - PullRequest
0 голосов
/ 06 марта 2019

Мне нужно создать веб-сервис с использованием wsdl из веб-сервиса, но проблема в том, что я не могу получить из него singleWSDL, потому что у него два разных пространства имен .Я могу генерировать другие веб-сервисы просто отлично, кроме этого.пожалуйста, имейте в виду, я новичок в wsdl2java и веб-сервисах в целом, код используется в проекте верблюда.

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions name="RoutingService" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:i1="http://schemas.microsoft.com/dynamics/2008/01/services" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
xmlns:tns="http://tempuri.org/" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" 
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" 
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:i0="http://schemas.microsoft.com/netfx/2009/05/routing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" 
xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" 
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"><wsp:Policy wsu:Id="serviceEndpoint_policy"><wsp:ExactlyOne><wsp:All><http:BasicAuthentication 
xmlns:http="http://schemas.microsoft.com/ws/06/2004/policy/http"/></wsp:All></wsp:ExactlyOne>
</wsp:Policy><wsp:Policy wsu:Id="BasicHttpBinding_GeneralJournalService_policy"><wsp:ExactlyOne>
<wsp:All><http:BasicAuthentication xmlns:http="http://schemas.microsoft.com/ws/06/2004/policy/http"/>
</wsp:All></wsp:ExactlyOne></wsp:Policy>
    <wsdl:import namespace="http://schemas.microsoft.com/netfx/2009/05/routing" location="special/wsdl0.wsdl"/>
    <wsdl:import namespace="http://schemas.microsoft.com/dynamics/2008/01/services" location="special/wsdl1.wsdl"/>
<wsdl:types/>
    <wsdl:binding name="serviceEndpoint" type="i0:IRequestReplyRouter">
    <wsp:PolicyReference URI="#serviceEndpoint_policy"/>
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
    </wsdl:binding>
    <wsdl:binding name="BasicHttpBinding_GeneralJournalService" type="i1:GeneralJournalService">
    <wsp:PolicyReference URI="#BasicHttpBinding_GeneralJournalService_policy"/>
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getKeys">
    <soap:operation soapAction="http://schemas.microsoft.com/dynamics/2008/01/services/GeneralJournalService/getKeys" style="document"/>
    <wsdl:input name="GeneralJournalServiceGetKeysRequest">
    <soap:header message="i1:GeneralJournalServiceGetKeysRequest_Headers" part="context" use="literal"/>
    <soap:body use="literal"/></wsdl:input><wsdl:output name="GeneralJournalServiceGetKeysResponse">
    <soap:body use="literal"/></wsdl:output><wsdl:fault name="AifFaultFault">
    <soap:fault name="AifFaultFault" use="literal"/></wsdl:fault>
</wsdl:operation>
<wsdl:operation name="create">
    <soap:operation soapAction="http://schemas.microsoft.com/dynamics/2008/01/services/GeneralJournalService/create" style="document"/>
    <wsdl:input name="GeneralJournalServiceCreateRequest"><soap:header message="i1:GeneralJournalServiceCreateRequest_Headers" part="context" use="literal"/>
    <soap:body use="literal"/></wsdl:input><wsdl:output name="GeneralJournalServiceCreateResponse"><soap:body use="literal"/>
    </wsdl:output>
    <wsdl:fault name="AifFaultFault"><soap:fault name="AifFaultFault" use="literal"/>
    </wsdl:fault>
</wsdl:operation>
    <wsdl:operation name="read">
    <soap:operation soapAction="http://schemas.microsoft.com/dynamics/2008/01/services/GeneralJournalService/read" style="document"/>
    <wsdl:input name="GeneralJournalServiceReadRequest"><soap:header message="i1:GeneralJournalServiceReadRequest_Headers" part="context" use="literal"/><soap:body use="literal"/>
    </wsdl:input>
    <wsdl:output name="GeneralJournalServiceReadResponse"><soap:body use="literal"/>
    </wsdl:output><wsdl:fault name="AifFaultFault">
    <soap:fault name="AifFaultFault" use="literal"/></wsdl:fault>
</wsdl:operation>
<wsdl:operation name="find">
    <soap:operation soapAction="http://schemas.microsoft.com/dynamics/2008/01/services/GeneralJournalService/find" style="document"/>
    <wsdl:input name="GeneralJournalServiceFindRequest"><soap:header message="i1:GeneralJournalServiceFindRequest_Headers" part="context" use="literal"/>
    <soap:body use="literal"/></wsdl:input><wsdl:output name="GeneralJournalServiceFindResponse"><soap:body use="literal"/>
    </wsdl:output><wsdl:fault name="AifFaultFault"><soap:fault name="AifFaultFault" use="literal"/></wsdl:fault>
</wsdl:operation>
<wsdl:operation name="getChangedKeys">
    <soap:operation soapAction="http://schemas.microsoft.com/dynamics/2008/01/services/GeneralJournalService/getChangedKeys" style="document"/>
    <wsdl:input name="GeneralJournalServiceGetChangedKeysRequest"><soap:header message="i1:GeneralJournalServiceGetChangedKeysRequest_Headers" part="context" use="literal"/>
    <soap:body use="literal"/></wsdl:input><wsdl:output name="GeneralJournalServiceGetChangedKeysResponse">
    <soap:body use="literal"/></wsdl:output><wsdl:fault name="AifFaultFault">
    <soap:fault name="AifFaultFault" use="literal"/></wsdl:fault></wsdl:operation></wsdl:binding>
    <wsdl:service name="RoutingService">
    <wsdl:port name="serviceEndpoint" binding="tns:serviceEndpoint"><soap:address location="http://server/MicrosoftDynamicsAXAif60/ESBLedgerService/xppservice.svc"/>
    </wsdl:port><wsdl:port name="BasicHttpBinding_GeneralJournalService" binding="tns:BasicHttpBinding_GeneralJournalService">
    <soap:address location="http://server/MicrosoftDynamicsAXAif60/ESBLedgerService/xppservice.svc"/></wsdl:port>
</wsdl:service></wsdl:definitions>

Вот конфигурация wsdl2java

 <plugin>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-codegen-plugin</artifactId>
    <version>3.2.1</version>
    <executions>
        <execution>
            <id>generate-sources</id>
            <phase>generate-sources</phase>
            <configuration>
                <defaultOptions>
                    <bindingFiles>
                        <bindingFile>src/main/resources/binding.xml</bindingFile>
                    </bindingFiles>
                </defaultOptions>
                <wsdlRoot>src/main/resources/wsdl</wsdlRoot>
                <includes>
                    <include>*.wsdl</include>
                </includes>
                <sourceRoot>${basedir}/target/generated-sources/jaxws</sourceRoot>
            </configuration>
            <goals>
                <goal>wsdl2java</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Здесь ошибкаЯ получаю, когда я пытаюсь сгенерировать код

[ERROR] Failed to execute goal org.apache.cxf:cxf-codegen-plugin:3.2.1:wsdl2java (generate-sources) on project model-service: org.apache.cxf.helpers.JavaUtils.isJava9Compatible()Z -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.cxf:cxf-codegen-plugin:3.2.1:wsdl2java (generate-sources) on project model-service: org.apache.cxf.helpers.JavaUtils.isJava9Compatible()Z
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    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)
Caused by: org.apache.maven.plugin.MojoExecutionException: org.apache.cxf.helpers.JavaUtils.isJava9Compatible()Z
    at org.apache.cxf.maven_plugin.wsdl2java.WSDL2JavaMojo.generate (WSDL2JavaMojo.java:434)
    at org.apache.cxf.maven_plugin.AbstractCodegenMoho.execute (AbstractCodegenMoho.java:279)
    at org.apache.cxf.maven_plugin.wsdl2java.WSDL2JavaMojo.execute (WSDL2JavaMojo.java:511)
    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)
Caused by: java.lang.NoSuchMethodError: org.apache.cxf.helpers.JavaUtils.isJava9Compatible()Z
    at org.apache.cxf.transport.http.CXFAuthenticator.addAuthenticator (CXFAuthenticator.java:55)
    at org.apache.cxf.transport.http.URLConnectionHTTPConduit.<init> (URLConnectionHTTPConduit.java:89)
    at org.apache.cxf.transport.http.HTTPTransportFactory.getConduit (HTTPTransportFactory.java:236)
    at org.apache.cxf.transport.http.HTTPTransportFactory.getConduit (HTTPTransportFactory.java:215)
    at org.apache.cxf.transport.TransportURIResolver.resolve (TransportURIResolver.java:115)
    at org.apache.cxf.wsdl11.CatalogWSDLLocator.getImportInputSource (CatalogWSDLLocator.java:114)
    at org.apache.cxf.wsdl11.AbstractWrapperWSDLLocator.getImportInputSource (AbstractWrapperWSDLLocator.java:85)
    at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema (WSDLReaderImpl.java:774)
    at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema (WSDLReaderImpl.java:864)
    at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema (WSDLReaderImpl.java:654)
    at com.ibm.wsdl.xml.WSDLReaderImpl.parseTypes (WSDLReaderImpl.java:610)
    at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions (WSDLReaderImpl.java:320)
    at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL (WSDLReaderImpl.java:2352)
    at com.ibm.wsdl.xml.WSDLReaderImpl.parseImport (WSDLReaderImpl.java:470)
    at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions (WSDLReaderImpl.java:312)
    at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL (WSDLReaderImpl.java:2352)
    at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL (WSDLReaderImpl.java:2338)
    at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition (WSDLManagerImpl.java:254)
    at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition (WSDLManagerImpl.java:164)
    at org.apache.cxf.tools.wsdlto.core.WSDLDefinitionBuilder.parseWSDL (WSDLDefinitionBuilder.java:80)
    at org.apache.cxf.tools.wsdlto.core.WSDLDefinitionBuilder.build (WSDLDefinitionBuilder.java:71)
    at org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11.JAXWSDefinitionBuilder.build (JAXWSDefinitionBuilder.java:83)
    at org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11.JAXWSDefinitionBuilder.build (JAXWSDefinitionBuilder.java:60)
    at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl (WSDLToJavaContainer.java:195)
    at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute (WSDLToJavaContainer.java:164)
    at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute (WSDLToJavaContainer.java:412)
    at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool (ToolRunner.java:105)
    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.maven_plugin.wsdl2java.WSDL2JavaMojo.generate (WSDL2JavaMojo.java:414)
    at org.apache.cxf.maven_plugin.AbstractCodegenMoho.execute (AbstractCodegenMoho.java:279)
    at org.apache.cxf.maven_plugin.wsdl2java.WSDL2JavaMojo.execute (WSDL2JavaMojo.java:511)
    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)
...