You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Dies Koper <di...@jp.fujitsu.com> on 2006/05/11 04:55:08 UTC

Re: Think I found a bug in wsdl2java handling reserved word "Case" - Where to go from here?

Hello Joshua,

It is really a bug.
For element names that are reserved Java keywords (case, public, if, 
etc.) Axis should prefix the Java field names with underscores.
However, "Case" is not a reserved keyword: the class name should not get 
the underscore.
I have never seen this in the BugDB, I think you are the first to find it.

"Where to go from here?": File a bug report:
http://issues.apache.org/jira/secure/CreateIssue!default.jspa

Regards,
Dies


Joshua.White@hartfordlife.com wrote:
> All,
> 
> How can I get around this problem?  Axis is generating a class file named 
> "_case" and using the instance name "_case" in my "EligibilityProfile" class. 
>  Is there any way around this or is this really a bug?
> 
> Joshua
> 
> 
> 
> 
> 	*Joshua.White@hartfordlife.com*
> 
> 05/05/2006 10:44 PM
> Please respond to axis-user
> 
> 	       
>         To:        axis-user@ws.apache.org
>         cc:        
>         Subject:        Think I found a bug in wsdl2java handling reserved word 
> "Case" -    Where to go from here?
> 
> 
> 
> 
> 
> Given the following simplified class:
> 
> public class EligibilityProfile {
>        private mypackager.*Case* _case;
> }
> 
> 
> The WSDL file get created fine:
> 
> <s0:complexType name="EligibilityProfile">
>    <s0:complexContent>
>        <s0:extension base="java:BaseDomainObject" 
> xmlns:java="java:mycompany.webservice.dto">
>            <s0:sequence>
>                <s0:element minOccurs="1" name="EligibilityProfileId" 
> nillable="true" type="xs:long" />
>                <s0:element minOccurs="1" name="Case" nillable="true" 
> type="java:Case" />
>            </s0:sequence>
>        </s0:extension>
>    </s0:complexContent>
> </s0:complexType>
> 
> When wsdl2java get run however, I get the following EligibilityProfile class 
> created (Note the case of the "_case" class name):
> 
> public class EligibilityProfile {
>        private mypackager.*_case* _case;
> }
> 
> This class won't even compile.  If I refactor "mypackager._class" in the 
> generated code to "mypackager.Class" it compiles, but I get a problem parsing a 
> message:
> 
>        *org.xml.sax.SAXException: Invalid element in 
> mycompany.webservice.dto.EligibilityProfile - case* *
>        at 
> org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.java:258)* 
> *
>        at 
> org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)* 
> 
> 
> How should I proceed?
> 
> Regards,
> 
> Joshua