2016-06-27 19 views
1

Ich versuche Java-Code aus wsdl für Exchange Web Service zu generieren.cxf-codegen-plugin ist beim Analysieren von wsdl fehlgeschlagen (JSXB: undefiniertes Attribut 'xml: lang')

Ich benutze Apache CXF-CODEGEN-Plugin konfiguriert als:

<project 
    xmlns="http://maven.apache.org/POM/4.0.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 

    <modelVersion>4.0.0</modelVersion> 

    <name>ews-api</name> 
    <groupId>net.retn</groupId> 
    <artifactId>ews-api</artifactId> 
    <version>1.0-SNAPSHOT</version> 
    <packaging>jar</packaging> 

    <properties> 
    <encoding>UTF-8</encoding> 
    <cxf.version>3.1.6</cxf.version> 
    </properties> 

    <build> 
    <plugins> 
     <plugin> 
     <groupId>org.apache.cxf</groupId> 
     <artifactId>cxf-codegen-plugin</artifactId> 
     <version>${cxf.version}</version> 
     <dependencies> 
      <dependency> 
       <groupId>net.retn</groupId> 
       <artifactId>cxf-ews-authenticator</artifactId> 
       <version>1.0-SNAPSHOT</version> 
      </dependency> 
     </dependencies> 
     <executions> 
      <execution> 
       <id>generate-sources</id> 
       <phase>generate-sources</phase> 
       <configuration> 
       <sourceRoot>${project.build.sourceDirectory}/</sourceRoot> 
       <wsdlOptions> 
        <wsdlOption> 
        <wsdl>https://server/EWS/Services.wsdl</wsdl> 
        <extraargs> 
         <extraarg>-b</extraarg> 
         <extraarg>${basedir}/src/main/resources/async_binding.xml</extraarg> 
        </extraargs> 
        </wsdlOption> 
       </wsdlOptions> 
       </configuration> 
       <goals> 
       <goal>wsdl2java</goal> 
       </goals> 
      </execution> 
     </executions> 
     </plugin> 
    </plugins> 
    </build> 

</project> 

Aber wenn ich ausführen: mvn kompilieren ein Fehler ausgelöst wird:

[ERROR] https://server/EWS/types.xsd [0:0]: undefined attribute 'xml:lang' 
org.xml.sax.SAXParseException; systemId: https://server/EWS/types.xsd; lineNumber: 0; columnNumber: 0; undefined attribute 'xml:lang' 
     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:727) 
     at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:271) 
     at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:165) 
     at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:416) 
     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.maven_plugin.wsdl2java.WSDL2JavaMojo.generate(WSDL2JavaMojo.java:415) 
     at org.apache.cxf.maven_plugin.AbstractCodegenMoho.execute(AbstractCodegenMoho.java:260) 
     at org.apache.cxf.maven_plugin.wsdl2java.WSDL2JavaMojo.execute(WSDL2JavaMojo.java:512) 
     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) 
     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207) 
     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) 
     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) 
     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) 
     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) 
     at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) 
     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) 
     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) 
     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) 
     at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) 
     at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863) 
     at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) 
     at org.apache.maven.cli.MavenCli.main(MavenCli.java:199) 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
     at java.lang.reflect.Method.invoke(Method.java:606) 
     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) 

types.xsd:

<xs:schema xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:tns="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xs="http://www.w3.org/2001/XMLSchema" id="types" elementFormDefault="qualified" version="Exchange2013_SP1" targetNamespace="http://schemas.microsoft.com/exchange/services/2006/types"> 
<xs:import namespace="http://www.w3.org/XML/1998/namespace"/> 
..... 
<xs:complexType name="ReplyBody"> 
<xs:sequence> 
<xs:element minOccurs="0" maxOccurs="1" name="Message" type="xs:string"/> 
</xs:sequence> 
<xs:attribute ref="xml:lang" use="optional"/> 
</xs:complexType> 
..... 
</xs:schema> 

Wer versucht so etwas zu tun? Was ist ein Problem?

+0

Können Sie die WSDL von hier 'https posten man reproduziert das Problem? – Tunaki

+0

Es ist eine sehr große Datei! Aber ich denke, das Problem ist in types.xsd oder ich liege falsch? – user2621486

Antwort

1

Ich habe die Lösung gefunden. Die Lage des XML-Schema für http://www.w3.org/XML/1998/namespace wurde geändert: // mail-lon.retn.net/EWS/Services.wsdl`, oder machen eine einfache:

Validating XML against XSD containing xsd:import without location

+0

Gibt es eine Möglichkeit, cxf-codegen-plugin so zu konfigurieren, dass das Schema types.xsd schemaLocation = "http://www.w3.org/2001/xml.xsd" für namespace = "http: // www .w3.org/XML/1998/namespace "ohne die Datei types.xsd (Remote-Datei) zu ändern – user2621486