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 "Brett Randall (JIRA)" <ax...@ws.apache.org> on 2004/12/16 20:36:59 UTC

[jira] Commented: (AXIS-1720) Java2WSDL, repeated types auto-mapping to xsd:anyType causes bad definition in schema

     [ http://nagoya.apache.org/jira/browse/AXIS-1720?page=comments#action_56787 ]
     
Brett Randall commented on AXIS-1720:
-------------------------------------

Which TestCase did it break?

I wasn't able to run the regression tests properly due to problems I had trying to quickly setup a build environment for Axis (properties dependent jar locations, etc.) - is there a developer's FAQ anywhere so I can be properly setup for Ant builds and help fix this?  http://ws.apache.org/axis/java/developers-guide.html (Development Environment) didn't get me over the line unfortunately.

My bug will probably have to remain ... I found the handling of namespace caching in Types very difficult to follow ... I'm not stunned that I regressed something - sorry.


> Java2WSDL, repeated types auto-mapping to xsd:anyType causes bad definition in schema
> -------------------------------------------------------------------------------------
>
>          Key: AXIS-1720
>          URL: http://nagoya.apache.org/jira/browse/AXIS-1720
>      Project: Axis
>         Type: Bug
>   Components: WSDL processing
>     Versions: 1.2RC2
>  Environment: J2SDK 1.4.2_06, Win2k
>     Reporter: Brett Randall
>  Attachments: AXIS-1720.patch.txt
>
> org.apache.axis.wsdl.fromJava.Types
> When running Java2WSDL on a class, if a type appears in the hierarchy contains more than once, _and_ that type is one without a SerializerFactory mapped _and_ it is a class that fails the isBeanCompatible test, Java2WSDL will create an invalid schema, by creating a namespace and then referencing a non-existent type in that namespace.
> Test class: java.util.Locale.  Such a class fails the isBeanCompatible test, due to its package.
> If a single field of type Locale exists in a type hierarchy, all is fine: Types can't find a serializer factory, so BeanSerializer defaults to XSD_ANYTYPE when types.writeType returns null.
> If two fields of the same type that fail isBeanCompatible occur in a type hierarchy, the first one is marked to be serialized as XSD_ANYTYPE, however the second one causes a problem, and is marked with a namespace, however the type is never defined in that namespace.
> The cause is the too-early adding-to-namespace-list of the qname, which is occuring before Types discovers that the type has no suitable factory.  The next pass through Types for the same class type causes a false hit on the already-processed list, and a bad namespace is assigned as a result.
> My fix for this is to move this block of code from Types.makeTypeElement():
>         // If we've already got this type (because it's a native type or
>         // because we've already written it), just add the type="" attribute
>         // (if appropriate) and return.
>         if (!addToTypesList(qName) && !anonymous) {
>         	if (containingElement != null) {
>                 containingElement.setAttribute("type", getQNameString(qName));
>             }
>             return true;
>         }
> ... down the method until after the point when a suitable SerializerFactory has been located, or not in the case of a class like java.util.Locale, in which case the false namespace mapping will not occur.
> If Java2WSDL is run against a class (or class hierarchy) with two fields of the same such type, the resulting schema will include a reference to a namespace:type that will not appear in the schema.
> Patch and very basic TestCase to follow (third method fails on 1.2RC2).  TestCase is based on the current contract of Types.writeType(), which must return null if a schema could not be created.
> Feel free to query me on this bug, as it is a little unusual.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.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