XFire

optionally add xs:any & xs:anyAttribute to complex types produced by Aegis WSDL builder

Details

  • Type: New Feature New Feature
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.1-beta-1
  • Component/s: Aegis Module, Annotations
  • Labels:
    None
  • Environment:
    all
  • Number of attachments :
    6

Description

In order to future proof web service clients so that evolving schemas do not
break existing clients, I would like to add some functionality to the Aegis
WSDL building module.

The proposal is to optionally add:

<xs:any minOccurs="0" maxOccurs="unbounded"/>
and
<xs:anyAttribute/>

To complex types produced by the Aegis WSDL creation classes.

  1. ConfigurationTest.patch
    22/Mar/06 8:15 AM
    4 kB
    Adam J Chesney
  2. JIRA295PlusAegisPatch.patch
    13/Mar/06 8:53 AM
    52 kB
    Adam J Chesney
  3. JIRA295PlusAegisPatch-updated.patch
    16/Mar/06 6:14 AM
    57 kB
    Adam J Chesney
  4. JIRA295PlusJava5Patch.patch
    13/Mar/06 8:54 AM
    11 kB
    Adam J Chesney
  5. JIRA295PlusJava5Patch-updated.patch
    16/Mar/06 6:14 AM
    14 kB
    Adam J Chesney
  6. NillableWorksWithNewTests.patch
    23/Mar/06 4:33 AM
    12 kB
    Adam J Chesney

Activity

Hide
Adam J Chesney added a comment -

Attached is 2 patches, one for the Aegis module and one for the Java5 module.

These patches add the following functionality:

1) extensibleElements defaulted to true - <xsd:any minOccurs="0" maxOccurs="unbounded"/> added to complex types in WSDL so that client's built against one version of the WSDL will no longer break when invoking a newer version of the service which contains new properties that are returned as elements

Globally configured by setting defaultExtensibleElements property on DefaultTypeMappingRegistry.
Overridable in the mapping file by adding extensibleElements to mapping file (untested)
Overridable using Java5 Annotations with new attribute extensibleElements added to XmlType annotation.

2) extensibleAttributes defaulted to true - <xsd:anyAttribute/> added to complex types in WSDL so that client's built against one version of the WSDL will no longer break when invoking a newer version of the service which contains new properties that are returned as attributes

Globally configured by setting defaultExtensibleAttributes property on DefaultTypeMappingRegistry.
Overridable in the mapping file by adding extensibleAttributes to mapping file (untested)
Overridable using Java5 Annotations with new attribute extensibleAttributess added to XmlType annotation.

3) minOccurs="0" is now configurable, although it does still default to true.

Globally configured by setting defaultMinOccurs (int) property on DefaultTypeMappingRegistry.
Overridable in the mapping file by adding minOccurs to mapping file (untested)
Overridable using Java5 Annotations with new String attribute minOccurs added to XmlElement annotation.

4) Nillable is now also more configurable and it still defaults to true.

Globally configured by setting defaultNillable property on DefaultTypeMappingRegistry.
I had to add a new boolean property to Type.java called nullable which allowed me to split the nullability (basically if the java type is a primitive) from the nillability (whether or not the user wants nillable="true" in the xml).

So now if you want to override all the defaults, then you should configure your DefaultTypeMappingRegistry like this:

<bean id="typeMappingRegistry" class="org.codehaus.xfire.aegis.type.DefaultTypeMappingRegistry">
<property name="defaultExtensibleElements" value="false"/>
<property name="defaultExtensibleAttributes" value="false"/>
<property name="defaultNillable" value="false"/>
<property name="defaultMinOccurs" value="1"/>
</bean>

Hope it is satisfactory

Show
Adam J Chesney added a comment - Attached is 2 patches, one for the Aegis module and one for the Java5 module. These patches add the following functionality: 1) extensibleElements defaulted to true - <xsd:any minOccurs="0" maxOccurs="unbounded"/> added to complex types in WSDL so that client's built against one version of the WSDL will no longer break when invoking a newer version of the service which contains new properties that are returned as elements Globally configured by setting defaultExtensibleElements property on DefaultTypeMappingRegistry. Overridable in the mapping file by adding extensibleElements to mapping file (untested) Overridable using Java5 Annotations with new attribute extensibleElements added to XmlType annotation. 2) extensibleAttributes defaulted to true - <xsd:anyAttribute/> added to complex types in WSDL so that client's built against one version of the WSDL will no longer break when invoking a newer version of the service which contains new properties that are returned as attributes Globally configured by setting defaultExtensibleAttributes property on DefaultTypeMappingRegistry. Overridable in the mapping file by adding extensibleAttributes to mapping file (untested) Overridable using Java5 Annotations with new attribute extensibleAttributess added to XmlType annotation. 3) minOccurs="0" is now configurable, although it does still default to true. Globally configured by setting defaultMinOccurs (int) property on DefaultTypeMappingRegistry. Overridable in the mapping file by adding minOccurs to mapping file (untested) Overridable using Java5 Annotations with new String attribute minOccurs added to XmlElement annotation. 4) Nillable is now also more configurable and it still defaults to true. Globally configured by setting defaultNillable property on DefaultTypeMappingRegistry. I had to add a new boolean property to Type.java called nullable which allowed me to split the nullability (basically if the java type is a primitive) from the nillability (whether or not the user wants nillable="true" in the xml). So now if you want to override all the defaults, then you should configure your DefaultTypeMappingRegistry like this: <bean id="typeMappingRegistry" class="org.codehaus.xfire.aegis.type.DefaultTypeMappingRegistry"> <property name="defaultExtensibleElements" value="false"/> <property name="defaultExtensibleAttributes" value="false"/> <property name="defaultNillable" value="false"/> <property name="defaultMinOccurs" value="1"/> </bean> Hope it is satisfactory
Hide
Adam J Chesney added a comment -

Also required is the Java5 bits and pieces.

Show
Adam J Chesney added a comment - Also required is the Java5 bits and pieces.
Hide
Dan Diephouse added a comment -

Adam, this looks ok, but it seems that some of the tests don't pass. Can you check them out? It seems like there are problems with nillability and Dates. (See the BeanTest)

Also, if you could write a test or two to test the new extensibility stuff that would be most appreciated.

Show
Dan Diephouse added a comment - Adam, this looks ok, but it seems that some of the tests don't pass. Can you check them out? It seems like there are problems with nillability and Dates. (See the BeanTest) Also, if you could write a test or two to test the new extensibility stuff that would be most appreciated.
Hide
Adam J Chesney added a comment -

updated patches that include updates to default values that were causeing tests to break and also some new test cases to cover the additions i have made.

Show
Adam J Chesney added a comment - updated patches that include updates to default values that were causeing tests to break and also some new test cases to cover the additions i have made.
Hide
Adam J Chesney added a comment -

patch that just adds a Test case for Configuration in order to test the changing of default values for minOccurs, Nillable , ExtensibleAttributes and ExtensibleElements.

Show
Adam J Chesney added a comment - patch that just adds a Test case for Configuration in order to test the changing of default values for minOccurs, Nillable , ExtensibleAttributes and ExtensibleElements.
Hide
Adam J Chesney added a comment -

This patch (to the root of the xfire tree) fixes Nillable and makes it configurable. I have added nillable to BeanTypeInfo, just like MinOccurs. There are 2 new test cases called ConfiguationTest to test the defaults in both the XMLTypeCreator and the Java5TypeCreator. I also needed to make the default for configuration in AbstractTypeCreator not null to stop a bunch of tests breaking.

Show
Adam J Chesney added a comment - This patch (to the root of the xfire tree) fixes Nillable and makes it configurable. I have added nillable to BeanTypeInfo, just like MinOccurs. There are 2 new test cases called ConfiguationTest to test the defaults in both the XMLTypeCreator and the Java5TypeCreator. I also needed to make the default for configuration in AbstractTypeCreator not null to stop a bunch of tests breaking.
Hide
Dan Diephouse added a comment -

I integrated your patch and things work swell now. You rock!

Show
Dan Diephouse added a comment - I integrated your patch and things work swell now. You rock!

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: