简体   繁体   English

axis2无法使用内联架构从wsdl生成java

[英]axis2 fails to generate java from wsdl with inline schema

I want to generate Java classes from a WSDL. 我想从WSDL生成Java类。 I'm invoking wsdl2java from within an ant task. 我正在一个ant任务中调用wsdl2java。 The commandline would look like this: 命令行看起来像这样:

java -cp ... org.apache.axis2.wsdl.WSDL2Java -o generated_dir -S . -R . -l java -p "com.make.me.rich" -d adb -or --noBuildXML -uri MakeMeRich.wsdl

The MakeMeRich.wsdl contains inlined schemas from Micrsosoft, eg: MakeMeRich.wsdl包含来自Micrsosoft的内联架构,例如:

<xsd:schema elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
  <xsd:complexType name="ArrayOfint">
    <xsd:sequence>
      <xsd:element minOccurs="0" maxOccurs="unbounded" name="int" type="xsd:int" />
    </xsd:sequence>
  </xsd:complexType>
  <xsd:element name="ArrayOfint" nillable="true" type="tns:ArrayOfint" />
    <xsd:complexType name="ArrayOfKeyValueOfstringstring">
      <xsd:annotation>
        <xsd:appinfo>
          <IsDictionary xmlns="http://schemas.microsoft.com/2003/10/Serialization/">true</IsDictionary>
        </xsd:appinfo>
      </xsd:annotation>
      <xsd:sequence>
        <xsd:element minOccurs="0" maxOccurs="unbounded" name="KeyValueOfstringstring">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="Key" nillable="true" type="xsd:string" />
              <xsd:element name="Value" nillable="true" type="xsd:string" />
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  <xsd:element name="ArrayOfKeyValueOfstringstring" nillable="true" type="tns:ArrayOfKeyValueOfstringstring" />
</xsd:schema>

But the wsdl2java parser gives a warning: 但是wsdl2java解析器会发出警告:

[java] Warning: No schemaLocation for import of http://schemas.microsoft.com/2003/10/Serialization/Arrays; compilation may fail

Any ideas how to handle inline schemas with wsdl2java? 有关如何使用wsdl2java处理内联架构的任何想法?

使用数据绑定xmlbeans似乎解决了这个问题: -d xmlbeans

Which version of Axis2 are you using? 您使用的是哪个版本的Axis2? I'm facing a similiar problem with version 1.6.x while everything works fine with 1.5.x and below. 我面临类似1.6.x版本的类似问题,而1.5.x及以下版本的一切正常。 Could you try it with an older version? 你能用旧版本试试吗? In my opinion using xmlbeans is not a solution, it's just a workaround. 在我看来,使用xmlbeans不是一个解决方案,它只是一种解决方法。

将其作为wsdl中的内联架构。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM