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 bu...@apache.org on 2004/02/10 23:57:50 UTC

DO NOT REPLY [Bug 21973] - BeanSerializer generates invalid WSDL for interfaces

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21973>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21973

BeanSerializer generates invalid WSDL for interfaces





------- Additional Comments From jmilgram@msn.com  2004-02-10 22:57 -------
I ran into a similar issue.  I have a JavaBean interface that I would like Axis 
to consume via a beanMapping; there is a corresponding concrete JavaBean with a 
default ctor available.  To work around this, I had to change more code than 
mentioned in the original bug report.  Part of it is related to concrete 
instances (I didn't know how to teach Axis to understand an interface has a 
corresponding implementation class) and part of it is related to array 
serialization.  Here are my mods for your consideration.  The methods to test 
for an interface with concrete impl and create the corresponding impl are not 
actually shown.

ArraySerializer:
This section of code
        // Get the QName of the componentType.  
        // If not found, look at the super classes
        QName componentQName = context.getQNameForClass(componentType);
        if (componentQName == null) {
            Class searchCls = componentType;
            while(searchCls != null && componentQName == null) {
            	// JM BEGIN edit to support mapping of interface to Impl
            	// If this is an i/f, map to impl, otherwise check superclass
            	if (! isImplWithInterface(searchCls)) {
            		searchCls = searchCls.getSuperclass();
            	}
            	else try {
            		searchCls = mapImplToInterface(searchCls);
            	} catch (Exception ex) {
            		throw new IOException("Error mapping interface to Impl 
class: " + searchCls + ": " + ex);
            	}
            	// JM END edit
                componentQName = context.getQNameForClass(searchCls);
            }
BeanSerializer (very similar to original bug submission):
// JM BEGIN Mod here
// Replacement code (if Impl is found, not abstract in deserializer)       
        if (Modifier.isAbstract(javaType.getModifiers())) {
        	if (! isInterfaceWithImpl(javaType)) {
        		complexType.setAttribute("abstract", "true");
        	}
        }
// JM END Mod here

BeanDeserializer (3 times, each time there is javaType.newInstance()):
        	// JM BEGIN Mod here
                if (! isInterfaceWithImpl(javaType) {
                    value=javaType.newInstance();
                else
        	    value = createImplFromInterface(javaType);
        	// JM END Mod here