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 Davanum Srinivas <di...@yahoo.com> on 2003/03/12 18:53:06 UTC

Map/HashMap with .NET (was Re: cvs commit: xml-axis/java/src/org/apache/axis/encoding/ser MapDeserializer.java MapSerializer.java)

Folks,

Any objections to this check-in? 

Thanks,
dims

--- dims@apache.org wrote:
> dims        2003/03/12 09:49:08
> 
>   Modified:    java/src/org/apache/axis/encoding/ser MapDeserializer.java
>                         MapSerializer.java
>   Log:
>   Fix for Bug 17703 - Java2WSDL creates .Net interop incompatible map type
>   
>   Notes:
>   - Uses soapenc:Array
>   - Tested with .NET Framework SDK 1.1
>   - See discussion (http://marc.theaimsgroup.com/?t=102650467100001&r=1&w=2)
>   
>   Revision  Changes    Path
>   1.24      +13 -9     xml-axis/java/src/org/apache/axis/encoding/ser/MapDeserializer.java
>   
>   Index: MapDeserializer.java
>   ===================================================================
>   RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/MapDeserializer.java,v
>   retrieving revision 1.23
>   retrieving revision 1.24
>   diff -u -r1.23 -r1.24
>   --- MapDeserializer.java	11 Dec 2002 22:38:15 -0000	1.23
>   +++ MapDeserializer.java	12 Mar 2003 17:49:07 -0000	1.24
>   @@ -143,16 +143,20 @@
>                log.debug("Enter: MapDeserializer::onStartChild()");
>            }
>    
>   -        ItemHandler handler = new ItemHandler(this);
>   -        
>   -        // This item must be complete before we're complete...
>   -        addChildDeserializer(handler);
>   -        
>   -        if (log.isDebugEnabled()) {
>   -            log.debug("Exit: MapDeserializer::onStartChild()");
>   +        if(localName.equals("item")) {
>   +            ItemHandler handler = new ItemHandler(this);
>   +            
>   +            // This item must be complete before we're complete...
>   +            addChildDeserializer(handler);
>   +            
>   +            if (log.isDebugEnabled()) {
>   +                log.debug("Exit: MapDeserializer::onStartChild()");
>   +            }
>   +    
>   +            return handler;
>            }
>   -
>   -        return handler;
>   +        
>   +        return this;
>        }
>        
>        /**
>   
>   
>   
>   1.20      +48 -22    xml-axis/java/src/org/apache/axis/encoding/ser/MapSerializer.java
>   
>   Index: MapSerializer.java
>   ===================================================================
>   RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/MapSerializer.java,v
>   retrieving revision 1.19
>   retrieving revision 1.20
>   diff -u -r1.19 -r1.20
>   --- MapSerializer.java	11 Dec 2002 22:38:15 -0000	1.19
>   +++ MapSerializer.java	12 Mar 2003 17:49:07 -0000	1.20
>   @@ -56,6 +56,8 @@
>    package org.apache.axis.encoding.ser;
>    
>    import org.apache.axis.Constants;
>   +import org.apache.axis.MessageContext;
>   +import org.apache.axis.schema.SchemaVersion;
>    import org.apache.axis.components.logger.LogFactory;
>    import org.apache.axis.encoding.SerializationContext;
>    import org.apache.axis.encoding.Serializer;
>   @@ -64,6 +66,7 @@
>    import org.apache.commons.logging.Log;
>    import org.w3c.dom.Element;
>    import org.xml.sax.Attributes;
>   +import org.xml.sax.helpers.AttributesImpl;
>    
>    import javax.xml.namespace.QName;
>    import java.io.IOException;
>   @@ -86,6 +89,7 @@
>    
>        // QNames we deal with
>        private static final QName QNAME_KEY = new QName("","key");
>   +    private static final QName QNAME_ITEMS = new QName("", "items");
>        private static final QName QNAME_ITEM = new QName("", "item");
>        private static final QName QNAME_VALUE = new QName("", "value");
>    
>   @@ -111,6 +115,16 @@
>            Map map = (Map)value;
>    
>            context.startElement(name, attributes);
>   +        
>   +        AttributesImpl itemsAttributes = new AttributesImpl();
>   +        String encodingURI = context.getMessageContext().getSOAPConstants().getEncodingURI();
>   +        String encodingPrefix = context.getPrefixForURI(encodingURI);
>   +        String soapPrefix = context.getPrefixForURI(Constants.SOAP_MAP.getNamespaceURI());
>   +        itemsAttributes.addAttribute(encodingURI, "type", encodingPrefix + ":type",
>   +                                   "CDATA", encodingPrefix + ":Array");        
>   +        itemsAttributes.addAttribute(encodingURI, "arrayType", encodingPrefix + ":arrayType",
>   +                                   "CDATA", soapPrefix + ":item["+map.size()+"]");        
>   +        context.startElement(QNAME_ITEMS, itemsAttributes);
>    
>            for (Iterator i = map.entrySet().iterator(); i.hasNext(); )
>            {
>   @@ -127,6 +141,7 @@
>            }
>    
>            context.endElement();
>   +        context.endElement();
>        }
>    
>        public String getMechanismType() { return Constants.AXIS_SAX; }
>   @@ -145,32 +160,43 @@
>        public Element writeSchema(Class javaType, Types types) throws Exception {
>            Element complexType = types.createElement("complexType");
>            complexType.setAttribute("name", "Map");
>   -        types.writeSchemaElement(Constants.SOAP_MAP, complexType);
>            Element seq = types.createElement("sequence");
>            complexType.appendChild(seq);
>   -
>            Element element = types.createElement("element");
>   -        element.setAttribute("name", "item");
>   -        element.setAttribute("minOccurs", "0");
>   -        element.setAttribute("maxOccurs", "unbounded");
>   +        element.setAttribute("name", "items");
>   +        element.setAttribute("nillable", "true");
>   +        element.setAttribute("type", types.getQNameString(new
> QName(Constants.NS_URI_XMLSOAP,"ArrayOfitem")));
>            seq.appendChild(element);
>   -
>   -        Element subType = types.createElement("complexType");
>   -        element.appendChild(subType);
>   -
>   -        Element all = types.createElement("all");
>   -        subType.appendChild(all);
>   -
>   -        Element key = types.createElement("element");
>   -        key.setAttribute("name", "key");
>   -        key.setAttribute("type", "xsd:anyType");
>   -        all.appendChild(key);
>   -
>   -        Element value = types.createElement("element");
>   -        value.setAttribute("name", "value");
>   -        value.setAttribute("type", "xsd:anyType");
>   -        all.appendChild(value);
>   -
>   +        types.writeSchemaElement(Constants.SOAP_MAP, complexType);
>   +    
>   +        Element arrayType = types.createElement("complexType");
>   +        arrayType.setAttribute("name", "ArrayOfitem");
>   +        Element complexContent = types.createElement("complexContent");
>   +        arrayType.appendChild(complexContent);
>   +        Element restriction = types.createElement("restriction");
>   +        restriction.setAttribute("base", "soapenc:Array");
>   +        complexContent.appendChild(restriction);
>   +        Element attribute = types.createElement("attribute");
>   +        attribute.setAttribute("ref","soapenc:arrayType");
>   +        attribute.setAttribute("wsdl:arrayType",types.getQNameString(new
> QName(Constants.NS_URI_XMLSOAP,"item[]")));
>   +        restriction.appendChild(attribute);
>   +        types.writeSchemaElement(Constants.SOAP_MAP, arrayType);
>   +
>   +        Element itemType = types.createElement("complexType");
>   +        itemType.setAttribute("name", "item");
>   +        Element seq2 = types.createElement("sequence");
>   +        itemType.appendChild(seq2);
>   +        Element element2 = types.createElement("element");
>   +        element2.setAttribute("name", "key");
>   +        element2.setAttribute("nillable", "true");
>   +        element2.setAttribute("type", "xsd:string");
>   +        seq2.appendChild(element2);
>   +        Element element3 = types.createElement("element");
>   +        element3.setAttribute("name", "value");
>   +        element3.setAttribute("nillable", "true");
>   +        element3.setAttribute("type", "xsd:string");
>   +        seq2.appendChild(element3);
>   +        types.writeSchemaElement(Constants.SOAP_MAP, itemType);
>            return complexType;
>        }
>    }
>   
>   
>   


=====
Davanum Srinivas - http://webservices.apache.org/~dims/

__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online
http://webhosting.yahoo.com

1.1 Final (was: Re: Map/HashMap with .NET (was Re: cvs commit: xml-axis/java/src/org/apache/axis/encoding/ser MapDeserializer.java MapSerializer.java))

Posted by James M Snell <ja...@us.ibm.com>.
Speaking of releasing 1.1 Final...

Are we just about ready to declare the code final and do a release?

- James Snell
     IBM Emerging Technologies
     jasnell@us.ibm.com
     (877) 511-5082 (voice/fax)   ** NEW NUMBER **
     (700) 930-1979 (t/l)                ** NEW NUMBER **
     Programming Web Services With SOAP
         O'Reilly & Associates, ISBN 0596000952

     Have I not commanded you? Be strong and courageous. 
     Do not be terrified, do not be discouraged, for the Lord your 
     God will be with you whereever you go.    - Joshua 1:9



"Steve Loughran" <st...@iseran.com>
03/12/2003 12:39 PM
Please respond to axis-dev


To
<ax...@ws.apache.org>
cc

bcc

Subject
Re: Map/HashMap with .NET (was Re: cvs commit: 
xml-axis/java/src/org/apache/axis/encoding/ser MapDeserializer.java 
MapSerializer.java)




----- Original Message -----
From: "Davanum Srinivas" <di...@yahoo.com>
To: <ax...@ws.apache.org>
Sent: Wednesday, March 12, 2003 10:32
Subject: Re: Map/HashMap with .NET (was Re: cvs commit:
xml-axis/java/src/org/apache/axis/encoding/ser MapDeserializer.java
MapSerializer.java)


> FYI. Ran "ant clean all-tests" :)

I have this theory, that however much you test, you will still ship with
what turns out to be a blazingly obvious defect. And whenever you ship a
point release you fix the previous defect, but introduce another critical
showstopper.

As an example, the recent ant1.5.3 drop turned out to produce files that
werent readable by winzip. Everything else worked, jar and the windowsXP
viewer all worked, but not winzip. Yet this (one line) defect didnt get
caught in the beta/RC phase, or in the gump, even though it was there. 
Three
days after 1.5.3 ship, we start getting support calls.

Axis1.0 had the Java1.4+servlets bug. I dont know what the sequel will be,
but I am sure it is there. It is like Fred Brook's description of the 
OS/360
projects continual bug chase: the number of defects stayed constant, but
their positions changed.

OSS is meant to fix that, many eyeballs and so on. Plus we can do a faster
turnaround time in closed source (which is why we fix .NET-Axis, interop,
and not the other way around). But from my experience, too many end users
steer clear of RC drops yet will pull down a release and run with it, even
though from an OSS project perspective there is little difference between
the two, or often even nightly builds. Yet the unit tests and the 
functional
tests we can run is a lot more limited than the real world. (FYI, the ant
test coverage is only 40%: http://codefeed.com/clover/report-ant-all/; I
dont know what axis' is)

When Axis1.1 ships, we will get complaints about some showstopper or
regression that we should have noticed. I dont think this change is it, 
but
I know it is out there, somewhere. And I dont see how we can fundamentally
alter our processes to catch it before we ship it, if the end-user testing
that finds it only surfaces when we ship 'release' code.

-Steve



Re: Map/HashMap with .NET (was Re: cvs commit: xml-axis/java/src/org/apache/axis/encoding/ser MapDeserializer.java MapSerializer.java)

Posted by Steve Loughran <st...@iseran.com>.
----- Original Message -----
From: "Davanum Srinivas" <di...@yahoo.com>
To: <ax...@ws.apache.org>
Sent: Wednesday, March 12, 2003 10:32
Subject: Re: Map/HashMap with .NET (was Re: cvs commit:
xml-axis/java/src/org/apache/axis/encoding/ser MapDeserializer.java
MapSerializer.java)


> FYI. Ran "ant clean all-tests" :)

I have this theory, that however much you test, you will still ship with
what turns out to be a blazingly obvious defect. And whenever you ship a
point release you fix the previous defect, but introduce another critical
showstopper.

As an example, the recent ant1.5.3 drop turned out to produce files that
werent readable by winzip. Everything else worked, jar and the windowsXP
viewer all worked, but not winzip. Yet this (one line) defect didnt get
caught in the beta/RC phase, or in the gump, even though it was there. Three
days after 1.5.3 ship, we start getting support calls.

Axis1.0 had the Java1.4+servlets bug. I dont know what the sequel will be,
but I am sure it is there. It is like Fred Brook's description of the OS/360
projects continual bug chase: the number of defects stayed constant, but
their positions changed.

OSS is meant to fix that, many eyeballs and so on. Plus we can do a faster
turnaround time in closed source (which is why we fix .NET-Axis, interop,
and not the other way around). But from my experience, too many end users
steer clear of RC drops yet will pull down a release and run with it, even
though from an OSS project perspective there is little difference between
the two, or often even nightly builds. Yet the unit tests and the functional
tests we can run is a lot more limited than the real world. (FYI, the ant
test coverage is only 40%: http://codefeed.com/clover/report-ant-all/; I
dont know what axis' is)

When Axis1.1 ships, we will get complaints about some showstopper or
regression that we should have noticed. I dont think this change is it, but
I know it is out there, somewhere. And I dont see how we can fundamentally
alter our processes to catch it before we ship it, if the end-user testing
that finds it only surfaces when we ship 'release' code.

-Steve


Re: Map/HashMap with .NET (was Re: cvs commit: xml-axis/java/src/org/apache/axis/encoding/ser MapDeserializer.java MapSerializer.java)

Posted by Davanum Srinivas <di...@yahoo.com>.
FYI. Ran "ant clean all-tests" :)

--- Steve Loughran <st...@iseran.com> wrote:
> 
> ----- Original Message -----
> From: "Davanum Srinivas" <di...@yahoo.com>
> To: <ax...@ws.apache.org>; <xm...@apache.org>
> Sent: Wednesday, March 12, 2003 09:53
> Subject: Map/HashMap with .NET (was Re: cvs commit:
> xml-axis/java/src/org/apache/axis/encoding/ser MapDeserializer.java
> MapSerializer.java)
> 
> 
> > Folks,
> >
> > Any objections to this check-in?
> >
> > Thanks,
> > dims
> 
> well, it depends on what else it breaks.
> 


=====
Davanum Srinivas - http://webservices.apache.org/~dims/

__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online
http://webhosting.yahoo.com

Re: Map/HashMap with .NET (was Re: cvs commit: xml-axis/java/src/org/apache/axis/encoding/ser MapDeserializer.java MapSerializer.java)

Posted by Steve Loughran <st...@iseran.com>.
----- Original Message -----
From: "Davanum Srinivas" <di...@yahoo.com>
To: <ax...@ws.apache.org>; <xm...@apache.org>
Sent: Wednesday, March 12, 2003 09:53
Subject: Map/HashMap with .NET (was Re: cvs commit:
xml-axis/java/src/org/apache/axis/encoding/ser MapDeserializer.java
MapSerializer.java)


> Folks,
>
> Any objections to this check-in?
>
> Thanks,
> dims

well, it depends on what else it breaks.