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=24386>.
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=24386

WSIF Axis provider does not correctly select registered custom 
serializers/deserializers

           Summary: WSIF Axis provider does not correctly select registered
                    custom serializers/deserializers
           Product: Axis-WSIF
           Version: 2.0
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Basic Architecture
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


When selecting a type mapping, the current Java type and XML type are not 
correctly compared with the registered typemaps. Here is the bug fix I had to 
do to make the Axis provider work with my custom JAXB serializer/deserializer. 
The fix is in the "findContextTypeSerialzer()" method of 
the "WSIFOperation_ApacheAxis" class

>>
private static TypeSerializerInfo findContextTypeSerialzer(
        WSIFMessage context,
        Class clazz,
        QName xmlType)
        throws WSIFException {

                Object value = null;
                try {
                        value = context.getObjectPart
(WSIFAXISConstants.CONTEXT_SOAP_TYPE_SERIALIZERS);
                } catch (WSIFException e) {
                        Trc.ignoredException(e);
                }
                if (value == null) {
                        return null;
                }
        if (!(value instanceof List)) {
                throw new WSIFException(
                    "context part '"
                    + WSIFAXISConstants.CONTEXT_SOAP_TYPE_SERIALIZERS
                    + "' value is not an instance of java.util.List: "
                    + value); 
        }
        
        List typeSerializers = (List) value;
        for (Iterator i = typeSerializers.iterator(); i.hasNext(); ) {
                Object o = i.next();
                if (!(o instanceof TypeSerializerInfo)) {
                    throw new WSIFException(
                        "context part '"
                        + WSIFAXISConstants.CONTEXT_SOAP_TYPE_SERIALIZERS
                        + "' value List contains an entry that is not an 
instance "
                        + "of org.apache.wsif.util.TypeSerializer: "
                        + value); 
                }
                TypeSerializerInfo tm = (TypeSerializerInfo) o;
                    
                Class javaType = tm.getJavaType();
                QName elementType = tm.getElementType();     
                Object serializer = tm.getSerializer();     
                Object deserializer = tm.getDeserializer();
                 
                if ((javaType != null) && (elementType != null))        {
                        boolean isSuperclass = javaType.isAssignableFrom(clazz);
                        boolean isSame           = elementType.equals(xmlType);
                        if      (isSuperclass && isSame)        {
                                        if (serializer == null || serializer 
instanceof SerializerFactory
                                                && deserializer == null || 
deserializer instanceof DeserializerFactory
                                                && serializer != null || 
deserializer != null) {
                                                        return tm;
                                        }                               
                        }
                }
                 
                /*   
                if ( (javaType != null) && (javaType.isAssignableFrom(clazz))
                && ( (elementType != null) && (elementType.equals(xmlType)) ) ){
                    if (serializer == null || serializer instanceof 
SerializerFactory
                    && deserializer == null || deserializer instanceof 
DeserializerFactory
                    && serializer != null || deserializer != null) {
                            return tm;
                    }
            }
            */
        }

        return null; // couldn't find a TypeSerializer
    }
<<
The original version always returns the first type mapping from the list, 
indenpendent of the actual Java and XML type.

Reply via email to