Xsd WSDL2Java故障-嵌套内容

Xsd WSDL2Java故障-嵌套内容,xsd,cxf,axis2,wsdl2java,Xsd,Cxf,Axis2,Wsdl2java,我试图使用Axis2 wsdl2java从一大组模式(总共15k行)生成java存根,但遇到了以下复杂类型的问题。最初,在我的模式文件上运行该工具时,我收到了一条不伦不类的错误消息,“unsupported content Simple content!”为了找到此错误的原因,我从源代码下载并部署了Axis2项目,找到了错误字符串并检查了导致问题的元素。 我相信问题的根源与简单内容中嵌套简单内容的复杂类型有关 我有两个例子,SequencedTextType失败,OpenTextType成功。这

我试图使用Axis2 wsdl2java从一大组模式(总共15k行)生成java存根,但遇到了以下复杂类型的问题。最初,在我的模式文件上运行该工具时,我收到了一条不伦不类的错误消息,“unsupported content Simple content!”为了找到此错误的原因,我从源代码下载并部署了Axis2项目,找到了错误字符串并检查了导致问题的元素。 我相信问题的根源与简单内容中嵌套简单内容的复杂类型有关

我有两个例子,SequencedTextType失败,OpenTextType成功。这两种类型的内容都是TextType的扩展。这将更容易发现问题并提供解释

失败的SequencedTextType:

<xs:element name="Reason" type="SequencedTextType" id="oagis-id-fa892eb1e28c46088bc50394c62a8655"/>

<xs:complexType name="SequencedTextType" id="oagis-id-51e010d7a1e24ebe89fcf58989fefd1b">
    <xs:complexContent>
        <xs:extension base="TextType">
            <xs:attribute name="sequenceNumber" type="NumberType_B98233" id="oagis-id-39a5a53826024a65a2291f50d9feecd3"/>
        </xs:extension>
    </xs:complexContent>
</xs:complexType>

<xs:simpleType name="NumberType_B98233" id="oagis-id-d614ed8726ff482c9c5a8183d735d9ed">
    <xs:restriction base="xs:integer"/>
</xs:simpleType>
<xs:complexType name="TextType" id="oagis-id-d97b8cf6a26f408db148163485796d15">
    <xs:simpleContent>
        <xs:extension base="TextType_62S0B4"/>
    </xs:simpleContent>
</xs:complexType>

<xs:complexType name="TextType_62S0B4" id="oagis-id-89be97039be04d6f9cfda107d75926b4">
    <xs:simpleContent>
        <xs:extension base="xs:string">
            <xs:attribute name="languageCode" type="clm56392A20081107_LanguageCodeContentType" id="oagis-id-c8d0c7094d7d4fbeb7e50fd20a17c1b3" use="optional"/>
        </xs:extension>
    </xs:simpleContent>
</xs:complexType>

<xs:simpleType name="clm56392A20081107_LanguageCodeContentType" id="oagis-id-c5e8ac8c44894e54a147a870136da686">
    <xs:restriction base="xs:normalizedString"/>
</xs:simpleType>
以下是相关的错误消息:

原因:org.apache.axis2.schema.SchemaComplationException:不支持的内容简单内容! 位于org.apache.axis2.schema.SchemaCompiler.copyMetaInfoHierarchy(SchemaCompiler.java:1396) 位于org.apache.axis2.schema.SchemaCompiler.processComplexContent(SchemaCompiler.java:1279) 位于org.apache.axis2.schema.SchemaCompiler.processContentModel(SchemaCompiler.java:1228) 位于org.apache.axis2.schema.SchemaCompiler.processComplexType(SchemaCompiler.java:1172) 位于org.apache.axis2.schema.SchemaCompiler.processNamedComplexSchemaType(SchemaCompiler.java:1092) 位于org.apache.axis2.schema.SchemaCompiler.processSchema(SchemaCompiler.java:1006) 位于org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:772) 位于org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:604) 位于org.apache.axis2.schema.SchemaCompiler.process(SchemaCompiler.java:2052) 位于org.apache.axis2.schema.SchemaCompiler.processParticle(SchemaCompiler.java:1935) 位于org.apache.axis2.schema.SchemaCompiler.processComplexContent(SchemaCompiler.java:1283) 位于org.apache.axis2.schema.SchemaCompiler.processContentModel(SchemaCompiler.java:1228) 位于org.apache.axis2.schema.SchemaCompiler.processComplexType(SchemaCompiler.java:1172) 位于org.apache.axis2.schema.SchemaCompiler.processNamedComplexSchemaType(SchemaCompiler.java:1092) 位于org.apache.axis2.schema.SchemaCompiler.processComplexContent(SchemaCompiler.java:1261) 位于org.apache.axis2.schema.SchemaCompiler.processContentModel(SchemaCompiler.java:1228) 位于org.apache.axis2.schema.SchemaCompiler.processComplexType(SchemaCompiler.java:1172) 位于org.apache.axis2.schema.SchemaCompiler.processNamedComplexSchemaType(SchemaCompiler.java:1092) 位于org.apache.axis2.schema.SchemaCompiler.processSchema(SchemaCompiler.java:1006) 位于org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:645) 位于org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:615) 位于org.apache.axis2.schema.SchemaCompiler.compile(SchemaCompiler.java:423) 位于org.apache.axis2.schema.SchemaCompiler.compile(SchemaCompiler.java:292) 位于org.apache.axis2.schema.ExtensionUtility.invoke(ExtensionUtility.java:102)


我希望能够深入了解为什么OpenTextType可以通过附带的Axis2方法,为什么SequencedTextType不能。谢谢。

我不太清楚为什么会这样。 但是,我从中找到了解决办法

当我使用
wsdl2java
命令添加
-dxmlbeans
时,它对我很有效

默认绑定是adb,它对这个简单的内容有一些问题。
在Axis2 1.7.x版本中,这似乎已经得到了修复。

我不太清楚为什么会发生这种情况。 但是,我从中找到了解决办法

当我使用
wsdl2java
命令添加
-dxmlbeans
时,它对我很有效

默认绑定是adb,它对这个简单的内容有一些问题。 在Axis2 1.7.x版本中,这似乎已经得到了修复

<xs:complexType name="TextType" id="oagis-id-d97b8cf6a26f408db148163485796d15">
    <xs:simpleContent>
        <xs:extension base="TextType_62S0B4"/>
    </xs:simpleContent>
</xs:complexType>

<xs:complexType name="TextType_62S0B4" id="oagis-id-89be97039be04d6f9cfda107d75926b4">
    <xs:simpleContent>
        <xs:extension base="xs:string">
            <xs:attribute name="languageCode" type="clm56392A20081107_LanguageCodeContentType" id="oagis-id-c8d0c7094d7d4fbeb7e50fd20a17c1b3" use="optional"/>
        </xs:extension>
    </xs:simpleContent>
</xs:complexType>

<xs:simpleType name="clm56392A20081107_LanguageCodeContentType" id="oagis-id-c5e8ac8c44894e54a147a870136da686">
    <xs:restriction base="xs:normalizedString"/>
</xs:simpleType>
private void copyMetaInfoHierarchy(BeanWriterMetaInfoHolder metaInfHolder,
                                   QName baseTypeName,
                                   XmlSchema parentSchema)
        throws SchemaCompilationException {

    //... Code omitted for clarity

    // see whether this type is also extended from some other type first
    // if so proceed to set their parents as well.
    if (type instanceof XmlSchemaComplexType) {
        XmlSchemaComplexType complexType = (XmlSchemaComplexType) type;
        if (complexType.getContentModel() != null) {
            XmlSchemaContentModel content = complexType.getContentModel();
            if (content instanceof XmlSchemaComplexContent) {
                //continue recursion 
            } else if (content instanceof XmlSchemaSimpleContent) {
                /***** TextType throws error in this branch *****/ 
                throw new SchemaCompilationException(
                        SchemaCompilerMessages.getMessage("schema.unsupportedcontenterror", "Simple Content"));
            } else {
                throw new SchemaCompilationException(
                        SchemaCompilerMessages.getMessage("schema.unknowncontenterror"));
            }
        }
        //Do the actual parent setting
        metaInfHolder.setAsParent(baseMetaInfoHolder);
    }
    //... Code omitted for clarity
}