axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
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
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:

View the issue:

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
             WSDL processing
             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

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:element name="choiceA" type="xsd:int"/>
          <xsd:element name="choiceB" type="xsd:string"/>
          <xsd:element name="choiceC" type="xsd:string"/>
---- snip here ----

When run through WSDL2Java, it generates the attached 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 ----
  <choiceB xsi:null="true"/>
  <choiceC xsi:null="true"/>
---- snip here ----

The above is not valid XML.

This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:

If you want more information on JIRA, or have a bug to report see:

View raw message