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 "Ashutosh Shahi (JIRA)" <ax...@ws.apache.org> on 2004/11/03 14:47:37 UTC

[jira] Commented: (AXIS-1466) Error with array of objects with in definition

     [ http://nagoya.apache.org/jira/browse/AXIS-1466?page=comments#action_54979 ]
     
Ashutosh Shahi commented on AXIS-1466:
--------------------------------------


The error occurs because of adding xsd:attribute in xsd:extension to the wsdl. My feeling is this error will occur whenever we use xsd:attribute with Multirefs, and not only for extension. This is happening as the attribute value in one pass while creating Multiref is not flushed out, and subsequent passes for other tags retain that attribute value. In this case, it resulted in a bug as a tag ended up with duplicate attribute values because flushing was not happening. If we look at the soap message created at client code for above example:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <ns1:addEntry soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:AddressFetcher2">
         <name xsi:type="xsd:string">Purdue Boilermaker</name>
         <address href="#id0"/>
      </ns1:addEntry>
      <multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:address" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="urn:AddressFetcher2">
         <streetNum href="#id1"/>
         <streetName xsi:type="xsd:string">University Drive</streetName>
         <city xsi:type="xsd:string">West Lafayette</city>
         <state href="#id2"/>
         <zip href="#id3"/>
         <phoneNumber href="#id4"/>
         <text href="#id5"/>
         <text href="#id6"/>
      </multiRef>
      <multiRef id="id3" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">47907</multiRef>
      <multiRef id="id6" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" aaabbb="en_1" xsi:type="ns3:mytext" xmlns:ns3="urn:AddressFetcher2" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">text1_1</multiRef>
      <multiRef id="id4" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" aaabbb="en_1" xsi:type="ns4:phone" xmlns:ns4="urn:AddressFetcher2" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
         <areaCode href="#id7"/>
         <exchange xsi:type="xsd:string">494</exchange>
         <number xsi:type="xsd:string">4900</number>
      </multiRef>
      <multiRef id="id2" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" aaabbb="en_1" xsi:type="ns5:stateType" xmlns:ns5="urn:AddressFetcher2" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">IN</multiRef>
      <multiRef id="id5" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" aaabbb="en_1" aaabbb="en" xsi:type="ns6:mytext" xmlns:ns6="urn:AddressFetcher2" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">text1</multiRef>
      <multiRef id="id1" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" aaabbb="en_1" aaabbb="en" xsi:type="xsd:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">1</multiRef>
      <multiRef id="id7" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" aaabbb="en_1" aaabbb="en" xsi:type="xsd:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">765</multiRef>
   </soapenv:Body></soapenv:Envelope>

We see that once an attribute, aaabbb in this example, is added to a multiref, its retained in subsequent multirefs also. 

I think the code change needs to go in SerializationContext.java, but i am not exacly sure, can someone point out the relevant setions of the code where the change needs to be done?

Thanks,
Ashutosh   

> Error with array of objects with <xsd:extension base="xsd:string"> in definition
> --------------------------------------------------------------------------------
>
>          Key: AXIS-1466
>          URL: http://nagoya.apache.org/jira/browse/AXIS-1466
>      Project: Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2 Beta
>  Environment: java 1.4 / [ Win 2000 | linux ]
>     Reporter: An Tin
>     Priority: Critical

>
>  1) Modify example Address Book (folder samples\addr in standard destribution.
> File AddressBook.wsdl :
> Add element :
>  <xsd:complexType name="mytext">
>    <xsd:simpleContent>
>     <xsd:extension base="xsd:string">
>       <xsd:attribute name="aaabbb" type="xsd:string"/>
>     </xsd:extension>
>    </xsd:simpleContent>
>   </xsd:complexType>
> Modify element :
>       <xsd:complexType name="address">
>         <xsd:all>
>             <xsd:element name="streetNum" type="xsd:int"/>
>             <xsd:element name="streetName" type="xsd:string"/>
>             <xsd:element name="city" type="xsd:string"/>
>             <xsd:element name="state" type="typens:stateType"/>
>             <xsd:element name="zip" type="xsd:int"/>
>             <xsd:element name="phoneNumber" type="typens:phone"/>
>             <xsd:element name="text" type="typens:mytext"  minOccurs="0" maxOccurs="unbounded"/>
>         </xsd:all>
>       </xsd:complexType>
> File Main.java : in section STATIC add :
>         Mytext mt1 = new Mytext();
>          mt1.setAaabbb("en");
>          mt1.setValue("text1");
>         Mytext mt1_1 = new Mytext();
>           mt1_1.setAaabbb("en_1");
>           mt1_1.setValue("text1_1");
>         addr1.setText(new Mytext[]{mt1,mt1_1});
> 2) Run the example and get Exception.
> faultString: org.xml.sax.SAXParseException: Attribute "aaabbb" was already specified for element "multiRef".
> 3) This bug is stable. I found it in another application and modifyed example application to demonstrate it. Tried under win2000 and linux.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira