RE: Reexamining problem with Axis not generating container

2009-07-31 Thread KARR, DAVID (ATTCINW)
> -Original Message-
> From: KARR, DAVID (ATTCINW)
> Sent: Thursday, July 30, 2009 11:01 AM
> To: axis-user@ws.apache.org
> Subject: Reexamining problem with Axis not generating container
> 
> A couple weeks ago I posted a note about a problem (title "Axis skips
> generating type if it thinks it can just make an array") where Axis
1.3
> doesn't generate a container class if an element only has a single
> child.  I had thought the problem was just annoying, but now I'm
seeing
> it's more serious than that.  Axis fails to deserialize legal XML if I
> don't add a kludge element to make it create the container class.
> 
> When I generate code for the following:
> 
> 
>   
>  minOccurs="0" maxOccurs="unbounded"/>
> 
>   
> 
> 
> It generates a container class corresponding to the "PropertyData"
> element, and the class corresponding to the
> "SomethingItemPropertyListInfo" element has a data element of that
> type.
> 
> If I comment out the "Dummy" element, however, the data element in the
> class corresponding to the "SomethingItemPropertyListInfo" element is
> simply an array of "SomethingPropertyInfo".
> 
> This is annoying, but it's not fatal, as I can just change code
> references, depending on whether a container class was generated or
> not.
> 
> What is fatal is that when I don't have the "Dummy" element defined,
> then legal XML using these structures (note that "Dummy" is optional,
> so
> it doesn't need to be present in the data) fails to deserialize,
> throwing an exception like the following:
> 
> -
> 2009-07-30 09:49:29,551 ERROR
> [org.apache.axis.encoding.ser.BeanPropertyTarget] [set] [Thread:main]
-
> [Could not convert
> [Lcom.company.interfaces.csi.soap.types.SomethingServicePropertyInfo;
> to
> bean field 'itemPropertyListData', type
> [Lcom.company.interfaces.csi.soap.types.SomethingServicePropertyInfo;]
> 2009-07-30 09:49:29,551 ERROR [org.apache.axis.client.Call] [invoke]
> [Thread:main] - [Exception:]
> java.lang.IllegalArgumentException: argument type mismatch
>   at
>
org.apache.axis.encoding.ser.BeanPropertyTarget.set(BeanPropertyTarget.
> j
> ava:157)
>   at
>
org.apache.axis.encoding.DeserializerImpl.valueComplete(DeserializerImp
> l
> .java:249)
>   at
>
org.apache.axis.encoding.ser.ArrayDeserializer.valueComplete(ArrayDeser
> i
> alizer.java:583)
>   at
>
org.apache.axis.encoding.DeserializerImpl.endElement(DeserializerImpl.j
> a
> va:509)
>   at
>
org.apache.axis.encoding.DeserializationContext.endElement(Deserializat
> i
> onContext.java:1087)
>   at
>
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java
> :
> 171)
>   at
>
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.
> j
> ava:1141)
>   at
> org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)
>   at
> org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
>   at org.apache.axis.client.Call.invoke(Call.java:2467)
>   at org.apache.axis.client.Call.invoke(Call.java:2366)
>   at org.apache.axis.client.Call.invoke(Call.java:1812)
> 
> 
> If I'm understanding this correctly, this error message is saying that
> I
> have a value of type "SomethingServicePropertyInfo[]", and I'm trying
> to
> assign it to a field named "itemPropertyListData", which is of type
> "SomethingServicePropertyInfo[]".  I must be misunderstanding this,
> because I don't see how that could fail to convert.

If it matters, I've done some additional debugging and determined a
little more information.

The problem appears to occur when you have nested unbounded
(maxOccurs=unbounded) elements.  This produces a situation where a
generated instance variable and setter is of type "Name[][]"
(two-dimensional array).  Unfortunately, the resulting value to be
inserted is a "Name[]" (one-dimensional array).  In addition, the error
message that Axis constructs is incorrect.  The error message it
generates is the following:

"Could not convert
[Lcom.company.interfaces.csi.soap.types.SomethingServicePropertyInfo; to
bean field 'itemPropertyListData', type
[Lcom.company.interfaces.csi.soap.types.SomethingServicePropertyInfo;]"

But it should have been (notice the one "[" changing to "[["):

"Could not convert
[Lcom.company.interfaces.csi.soap.types.SomethingServicePropertyInfo; to
bean field 'itemPropertyListData', type
[[Lcom.company.interfaces.csi.soap.types.SomethingServicePropertyInfo;]"


Reexamining problem with Axis not generating container

2009-07-30 Thread KARR, DAVID (ATTCINW)
A couple weeks ago I posted a note about a problem (title "Axis skips
generating type if it thinks it can just make an array") where Axis 1.3
doesn't generate a container class if an element only has a single
child.  I had thought the problem was just annoying, but now I'm seeing
it's more serious than that.  Axis fails to deserialize legal XML if I
don't add a kludge element to make it create the container class.

When I generate code for the following:


  


  


It generates a container class corresponding to the "PropertyData"
element, and the class corresponding to the
"SomethingItemPropertyListInfo" element has a data element of that type.

If I comment out the "Dummy" element, however, the data element in the
class corresponding to the "SomethingItemPropertyListInfo" element is
simply an array of "SomethingPropertyInfo".

This is annoying, but it's not fatal, as I can just change code
references, depending on whether a container class was generated or not.

What is fatal is that when I don't have the "Dummy" element defined,
then legal XML using these structures (note that "Dummy" is optional, so
it doesn't need to be present in the data) fails to deserialize,
throwing an exception like the following:

-
2009-07-30 09:49:29,551 ERROR
[org.apache.axis.encoding.ser.BeanPropertyTarget] [set] [Thread:main] -
[Could not convert
[Lcom.company.interfaces.csi.soap.types.SomethingServicePropertyInfo; to
bean field 'itemPropertyListData', type
[Lcom.company.interfaces.csi.soap.types.SomethingServicePropertyInfo;]
2009-07-30 09:49:29,551 ERROR [org.apache.axis.client.Call] [invoke]
[Thread:main] - [Exception:]
java.lang.IllegalArgumentException: argument type mismatch
at
org.apache.axis.encoding.ser.BeanPropertyTarget.set(BeanPropertyTarget.j
ava:157)
at
org.apache.axis.encoding.DeserializerImpl.valueComplete(DeserializerImpl
.java:249)
at
org.apache.axis.encoding.ser.ArrayDeserializer.valueComplete(ArrayDeseri
alizer.java:583)
at
org.apache.axis.encoding.DeserializerImpl.endElement(DeserializerImpl.ja
va:509)
at
org.apache.axis.encoding.DeserializationContext.endElement(Deserializati
onContext.java:1087)
at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:
171)
at
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.j
ava:1141)
at
org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)
at
org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
at org.apache.axis.client.Call.invoke(Call.java:2467)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)


If I'm understanding this correctly, this error message is saying that I
have a value of type "SomethingServicePropertyInfo[]", and I'm trying to
assign it to a field named "itemPropertyListData", which is of type
"SomethingServicePropertyInfo[]".  I must be misunderstanding this,
because I don't see how that could fail to convert.