Я пытаюсь создать java-заглушки из большого набора схем (всего 15k строк) с помощью Axis2 wsdl2java и столкнулся с проблемой со сложным типом. Первоначально при запуске инструмента в моих файлах схемы я получил сообщение об ошибке, «неподдерживаемый контент Simple Content!» Чтобы найти причину этой ошибки, я загрузил и развернул проект Axis2 из источника, нашел строку ошибки и рассмотрел элемент, вызывающий проблему. Я считаю, что источник проблемы связан с вложением сложного типа с простым содержимым в простой контент.WSDL2Java Failure - Вложенный контент
У меня есть два примера, 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>
проходящее OpenTextType:
<xs:complexType name="OpenTextType" id="oagis-id-5840f7a57dd949ababcd1eb394b2840c">
<xs:simpleContent>
<xs:extension base="TextType">
<xs:attribute name="typeCode" type="CodeType_1E7368" id="oagis-id-2780e69800934662a4782be31c2bacf6"
use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="CodeType_1E7368" id="oagis-id-d2f721a297684b538e7dbb88cf5526bc">
<xs:restriction base="xs:token"/>
</xs:simpleType>
совместно TextType:
<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>
Axis2 метод:
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
}
А вот соответствующее сообщение об ошибке:
Вызванный: org.apache.axis2.schema.SchemaCompilationException: неподдерживаемый содержание Simple Content! на 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) at 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) at org.apache.axis2.schema.SchemaCompiler.processComplex Тип (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) at org.apache.axis2.schema.SchemaCompiler.compile (SchemaCompiler.java:292) at org.apache.axis2.schema.ExtensionUtility. вызывать (ExtensionUtility.java:102)
Я надеюсь на некоторое понимание, почему OpenTextType может пройти через присоединенный метод Axis2 и почему SequencedTextType не может. Спасибо.
Как вы решили проблему? – subbu