axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject [jira] Commented: (AXIS-429) Incorrect code generated from xsd:choice element in WSDL
Date Thu, 20 May 2004 14:57:01 GMT
The following comment has been added to this issue:

     Author: joel yu
    Created: Thu, 20 May 2004 7:55 AM
       Body:
I did not have the luxury to change the xsd, so I worked around this issue by doing the following:

make an interface as follow:
public interface ChoiceSupport {

  public boolean isChoicePart(String propertyName);
}

have all the Objects that contains xsd:choice implement this interface.

then in org.apache.axis.encoding.ser.BeanSerializer(axis 1.1 code), add the following code
at line 209(after call to propertyDescriptor[i].get(value); ):

if (value instanceof org.apache.axis.xsd.ChoiceSupport) {
  ChoiceSupport choice = (ChoiceSupport) value;
  if(choice.isChoicePart(propertyDescriptor[i].getName())) {
    if(propValue == null) continue;
  }
}


now, this work around involves the user know not to set any other choice item when one is
already set, ChoiceSupport can be extended to make it more userful.
---------------------------------------------------------------------
View this comment:
  http://issues.apache.org/jira/browse/AXIS-429?page=comments#action_35641

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/AXIS-429

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: AXIS-429
    Summary: Incorrect code generated from xsd:choice element in WSDL
       Type: Bug

     Status: Open

    Project: Axis
 Components: 
             WSDL processing
   Versions:
             current (nightly)

   Assignee: Axis Developers Mailing List
   Reporter: Doug Bitting

    Created: Wed, 9 Oct 2002 4:00 AM
    Updated: Thu, 20 May 2004 7:55 AM
Environment: Operating System: Windows NT/2K
Platform: PC

Description:
In one of the test cases (test\wsdl\types\ComprehensiveTypes.wsdl), you'll find 
the following schema definition:

---- snip here ----
      <xsd:complexType name="complexChoice">
        <xsd:choice>
          <xsd:element name="choiceA" type="xsd:int"/>
          <xsd:element name="choiceB" type="xsd:string"/>
          <xsd:element name="choiceC" type="xsd:string"/>
        </xsd:choice>
      </xsd:complexType>
---- snip here ----

When run through WSDL2Java, it generates the attached ComplexChoice.java file.  
This compiles and runs fine.  However, the SOAP request generated with this 
ends up with something like the following XML fragment (assuming an element 
named complexChoice):

---- snip here ----
<complexChoice>
  <choiceA>1</choiceA>
  <choiceB xsi:null="true"/>
  <choiceC xsi:null="true"/>
</complexChoice>
---- snip here ----

The above is not valid XML.


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.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


Mime
View raw message