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 xuliujuan <xu...@hotmail.com> on 2004/01/07 08:25:25 UTC

Atten :For Help: how to improve axis then it could solve the problem of " element and attribute are the same name"

I have attached  the wsdl and the xsd  And _AAAProfile.java is one of the
java file generated by axis.
B Rs
/Xuliujuan
----- Original Message -----
From: Ias <ia...@tmax.co.kr>
To: 'xuliujuan' <xu...@hotmail.com>
Cc: <ax...@ws.apache.org>
Sent: Wednesday, January 07, 2004 3:16 PM
Subject: RE: For Help: how to improve axis then it could solve the problem
of " element and attribute are the same name"


> Currently, JAX-RPC 1.1 spec doesn't mention about a possible collision
> between a nested element name and an attribute name within a type. Could
you
> provide your sample WSDL for more testings on other WSDL processors such
as
> Sun's RI? Perhaps we need to make some policy on how to handle the
> collision, for example, showing an appropriate error message.
>
> In addition, I'd like to share this short note from JAXB 1.0 spec with
you:
>
> Good schema-design practices also make collisions less likely. When
writing
> a schema it is inadvisable to use, in identical roles, names the are
> distinguished only by punctuation or case. Suppose a schema declares two
> attributes of a single element type, one named Foo and the other named
foo.
> Their generated access methods, namely getFoo and setFoo, will collide.
This
> situation would best be handled by revising the source schema, which would
> not only eliminate the collision but also improve the readability of the
> source schema and documents that use it.
>
> At last, if you're walking with J2EE 1.4, you can utilize JAX-RPC mapping
in
> order to resolve this trouble. See JSR 109 proposal at
> http://nagoya.apache.org/wiki/apachewiki.cgi?JSR109Proposal . Web services
> for J2EE is now at an early stage, so you may have to make considerable
> amount of efforts to make the technology your own in terms of both
> understanding and implementing it. Enterprise Web Services project for
Axis
> and Geronimo is wide open, and I'm looking forward to its progress
supported
> by many users.
>
> Regards,
>
> Ias
> ________________________________
>
> From: xuliujuan [mailto:xuliujuan@hotmail.com]
> Sent: Wednesday, January 07, 2004 2:52 PM
> To: iasandcb@tmax.co.kr; yin zhi jun
> Subject: For Help: how to improve axis then it could solve the
> problem of " element and attribute are the same name"
>
>
>
>
> Hi ,
>     When the element and attribute have the same name,the axis
> generates wrong code. That is to say Axis could not be able to distinguish
> the element and attrubute when their name are same. Axis just generate the
> same codes for them. eg.
> private axis.TypeOfNetworkType networkType;
> private axis.TypeOfNetworkType networkType; // attribute
> That will cause a lot of error.
>    Could you tell me how to improve it?
> There is an xsd example :
> <xs:element name="Administrator"
> substitutionGroup="cai3g:GetMODefinition">
> ..........
> <xs:element name="uid" type="xs:string"/>
> .........
> </xs:element>
> </xs:sequence>
> <xs:attribute name="uid" type="xs:string" use="required"/>
> </xs:extension>
> </xs:complexContent>
> </xs:complexType>
> </xs:element>
>   Any hints? Thank you very much in advance.
> Best wishes.
> /XuLiujuan
>
>
>

RE: Atten :For Help: how to improve axis then it could solve the problem of " element and attribute are the same name"

Posted by Ias <ia...@tmax.co.kr>.
I tested genericCai3g.wsdl by wscompile shipped with Sun's J2EE 1.4 RI.
Unfortunately it didn't generate any artifacts for
CreateAAAProfileAttributes element, which has the problematic naming.
Instead, I tested HelloWorldService.wsdl from JWSDP-1.3 examples with a
slightly modified part:

      <complexType name="sayHello">
        <sequence>
          <element name="string_1" type="string" nillable="true"/>
          <element name="string_2" type="string"
nillable="true"/></sequence>
          <attribute name="string_1" type="string" use="required"/>
      </complexType>

The result of wscompile is

error: modeler error: uniqueness constraint violation, duplicate member
"string_1" added to JavaStructureType "hello.SayHello"

In conclusion, Sun's RI doesn't process a WSDL containng this case and on
the contrary, BEA WebLogic covers it with its own methodology.

What do you think of this issue? As Steve pointed out, JAX-RPC spec has a
hole and hence we can't make any decision based on the spec. 

Ias

=========================================================
Lee, Changshin (Korean name)
Ias (International name)
               Company Web Site: http://www.tmax.co.kr
               Personal Web Site: http://www.iasandcb.pe.kr
---------------------------------------------------------
JSR 201, JSR 204 and JSR 222 EG member
Apache Axis (JAX-RPC and SAAJ) and JaxMe (JAXB) committer
R&D Institute
Tmax Soft, Inc.
========================================================= 

> -----Original Message-----
> From: xuliujuan [mailto:xuliujuan@hotmail.com] 
> Sent: Wednesday, January 07, 2004 4:25 PM
> To: axis-dev@ws.apache.org
> Subject: Atten :For Help: how to improve axis then it could 
> solve the problem of " element and attribute are the same name"
> 
> I have attached  the wsdl and the xsd  And _AAAProfile.java 
> is one of the java file generated by axis.
> B Rs
> /Xuliujuan
> ----- Original Message -----
> From: Ias <ia...@tmax.co.kr>
> To: 'xuliujuan' <xu...@hotmail.com>
> Cc: <ax...@ws.apache.org>
> Sent: Wednesday, January 07, 2004 3:16 PM
> Subject: RE: For Help: how to improve axis then it could 
> solve the problem of " element and attribute are the same name"
> 
> 
> > Currently, JAX-RPC 1.1 spec doesn't mention about a 
> possible collision 
> > between a nested element name and an attribute name within a type. 
> > Could
> you
> > provide your sample WSDL for more testings on other WSDL processors 
> > such
> as
> > Sun's RI? Perhaps we need to make some policy on how to handle the 
> > collision, for example, showing an appropriate error message.
> >
> > In addition, I'd like to share this short note from JAXB 
> 1.0 spec with
> you:
> >
> > Good schema-design practices also make collisions less likely. When
> writing
> > a schema it is inadvisable to use, in identical roles, 
> names the are 
> > distinguished only by punctuation or case. Suppose a schema 
> declares 
> > two attributes of a single element type, one named Foo and 
> the other 
> > named
> foo.
> > Their generated access methods, namely getFoo and setFoo, 
> will collide.
> This
> > situation would best be handled by revising the source 
> schema, which 
> > would not only eliminate the collision but also improve the 
> > readability of the source schema and documents that use it.
> >
> > At last, if you're walking with J2EE 1.4, you can utilize JAX-RPC 
> > mapping
> in
> > order to resolve this trouble. See JSR 109 proposal at 
> > http://nagoya.apache.org/wiki/apachewiki.cgi?JSR109Proposal . Web 
> > services for J2EE is now at an early stage, so you may have to make 
> > considerable amount of efforts to make the technology your own in 
> > terms of both understanding and implementing it. Enterprise Web 
> > Services project for
> Axis
> > and Geronimo is wide open, and I'm looking forward to its progress
> supported
> > by many users.
> >
> > Regards,
> >
> > Ias
> > ________________________________
> >
> > From: xuliujuan [mailto:xuliujuan@hotmail.com]
> > Sent: Wednesday, January 07, 2004 2:52 PM
> > To: iasandcb@tmax.co.kr; yin zhi jun
> > Subject: For Help: how to improve axis then it could solve 
> the problem 
> > of " element and attribute are the same name"
> >
> >
> >
> >
> > Hi ,
> >     When the element and attribute have the same name,the axis 
> > generates wrong code. That is to say Axis could not be able to 
> > distinguish the element and attrubute when their name are 
> same. Axis 
> > just generate the same codes for them. eg.
> > private axis.TypeOfNetworkType networkType; private 
> > axis.TypeOfNetworkType networkType; // attribute That will 
> cause a lot 
> > of error.
> >    Could you tell me how to improve it?
> > There is an xsd example :
> > <xs:element name="Administrator"
> > substitutionGroup="cai3g:GetMODefinition">
> > ..........
> > <xs:element name="uid" type="xs:string"/> .........
> > </xs:element>
> > </xs:sequence>
> > <xs:attribute name="uid" type="xs:string" use="required"/> 
> > </xs:extension> </xs:complexContent> </xs:complexType> </xs:element>
> >   Any hints? Thank you very much in advance.
> > Best wishes.
> > /XuLiujuan
> >
> >
> >
>