You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Sören-Helge Zaschke (JIRA)" <ax...@ws.apache.org> on 2007/05/04 14:38:15 UTC
[jira] Commented: (AXIS-2391) WSDL2Java ignores attributes for
complex types that have only element with maxOccurs=unbounded in sequence
[ https://issues.apache.org/jira/browse/AXIS-2391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12493661 ]
Sören-Helge Zaschke commented on AXIS-2391:
-------------------------------------------
It looks like the same bug as I have observed:
AXIS can not handle the following type definition:
<xsd:complexType name="SomeName">
<xsd:sequence>
<xsd:element name="N1" type="Type1" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="N2" type="Type2" use="required"/>
</xsd:complexType>
Fix 1:
Change the xsd by adding another element (that is not used), e.g.
<xsd:complexType name="SomeName">
<xsd:sequence>
<xsd:element name="N1" type="Type1" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="N2" type="Type2" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="N2" type="Type2" use="required"/>
</xsd:complexType>
Fix 2:
Correct the AXIS source code, SchemaUtils.java:
------------------------------------------------------------
public static QName getCollectionComponentQName(Node node,
QNameHolder itemQName,
BooleanHolder forElement,
SymbolTable symbolTable) {
// If we're going to turn "wrapped" arrays into types such that
...
}
if (element == null) {
return null;
}
// OK, exactly one element child of <sequence>,
// now check if there is no attribute
if (SchemaUtils.getChildByName(node, "attribute") != null) {
return null;
}
// continue the processing using that element ...
------------------------------------------------------------
> WSDL2Java ignores attributes for complex types that have only element with maxOccurs=unbounded in sequence
> ----------------------------------------------------------------------------------------------------------
>
> Key: AXIS-2391
> URL: https://issues.apache.org/jira/browse/AXIS-2391
> Project: Axis
> Issue Type: Bug
> Components: WSDL processing
> Affects Versions: 1.3
> Environment: Axis for Java v1.3
> java version "1.5.0_01"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
> Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode, sharing)
> Windows XP Professional, SP2
> Reporter: Vaduz
> Priority: Blocker
> Attachments: axis-2391.zip
>
>
> WSDL2Java generates wrong source code for the complex type of the following structure:
> <xs:complexType name="SomeListType">
> <xs:sequence>
> <xs:element name="Item" type="tns:ItemType" maxOccurs="unbounded"/>
> </xs:sequence>
> <xs:attribute name="attr1" type="xs:string" />
> <xs:attribute name="attr2" type="xs:string" />
> </xs:complexType>
> The complex type should be a sequence with only element, which has maxOccurs="unbounded".
> In this case all atributes are ignored and not included to the resulting type.
> Version 1.2 works correctly. Version 1.3 works correctly, if the sequense has includes more than one element.
> The sample WSDL used for test:
> --------------------------------------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <definitions name ="DayOfWeek"
> targetNamespace="http://www/bug/DayOfWeek.wsdl"
> xmlns:tns="http://www/bug/DayOfWeek.wsdl"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns="http://schemas.xmlsoap.org/wsdl/">
> <types>
> <xsd:schema>
> <xsd:complexType name="ReplyType">
> <xsd:sequence>
> <xsd:element name="Item" type="xsd:string" maxOccurs="unbounded"/>
> </xsd:sequence>
> <xsd:attribute name="attr1" type="xsd:string" />
> <xsd:attribute name="attr2" type="xsd:string" />
> </xsd:complexType>
> </xsd:schema>
> </types>
> <message name="DayOfWeekInput">
> <part name="date" type="xsd:date"/>
> </message>
> <message name="DayOfWeekResponse">
> <part name="dayOfWeek" type="tns:ReplyType"/>
> </message>
> <portType name="DayOfWeekPortType">
> <operation name="GetDayOfWeek">
> <input message="tns:DayOfWeekInput"/>
> <output message="tns:DayOfWeekResponse"/>
> </operation>
> </portType>
> <binding name="DayOfWeekBinding" type="tns:DayOfWeekPortType">
> <soap:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http"/>
> <operation name="GetDayOfWeek">
> <soap:operation soapAction="getdayofweek"/>
> <input>
> <soap:body use="encoded"
> namespace="http://www/bug"
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
> </input>
> <output>
> <soap:body use="encoded"
> namespace="http://www/bug"
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
> </output>
> </operation>
> </binding>
> <service name="DayOfWeekService" >
> <documentation>
> Returns the day-of-week name for a given date
> </documentation>
> <port name="DayOfWeekPort" binding="tns:DayOfWeekBinding">
> <soap:address location="http://www/dayofweek/DayOfWeek"/>
> </port>
> </service>
> </definitions>
> --------------------------------------------------
> For this WSDL Axis 1.2 generates the correct code:
> ...
> public www.bug.DayOfWeek_wsdl.ReplyType getDayOfWeek(java.util.Date date) ...
> ...
> Where reply type includes attributes attr1 and attr2 as well as Item array.
> Axis 1.3 does not generate ReplyType class at all, and declares getDayOfWeek as following:
> public java.lang.String[] getDayOfWeek(java.util.Date date)...
> which is obviosly wrong.
>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org