AXIS data binding can not process array Type response
-----------------------------------------------------

                 Key: TUSCANY-1683
                 URL: https://issues.apache.org/jira/browse/TUSCANY-1683
             Project: Tuscany
          Issue Type: Bug
          Components: Java SCA Axis Binding Extension
    Affects Versions: Java-SCA-0.99
         Environment: windows jboss axis2
            Reporter: wenchu


I want to publish a service, it interface describe below:
public interface UDBService{public User[] getUsersByCompanyId(String 
companyId);}

I use  java2wsdl tools of axis2 to generate wsdl, it describe below:
<xs:element name="getUsersByCompanyIdResponse">
<xs:complexType>
   <xs:sequence>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="return" 
nillable="true" type="xsd:User"/>
   </xs:sequence>
</xs:complexType>
</xs:element>

but i find org.apache.tuscany.sca.databinding.javabeans.JavaBean2XMLTransformer 
can run correct  and it check array type,change it correct. when client receive 
the xml, and 
org.apache.tuscany.sca.databinding.javabeans.XML2JavaBeanTransformer transform 
error.

the reason as below:
1.not to check it's type.
2.to create object use " L javaInstance = javaType.newInstance()  " it will 
throw exception ,because jdk not support use this method to create array type 
instance. It is line 82.

i  check the javaType and do anther process,modify code as below:

                // mod by wenchu.cenwc array type process
                if (javaType.isArray())
                {
                        L javaInstance = 
(L)Array.newInstance(Class.forName(javaType.getComponentType().getName())
                                                        , childElements.size());
                        
                        for (int count = 0; count < childElements.size(); 
++count) 
                        {
                                Object node = 
createJavaObject(childElements.get(count)
                                                
,Class.forName(javaType.getComponentType().getName()),context);
                                
                                Array.set(javaInstance, count, node);
                        }
                        
                        return javaInstance;
                }
                else
                {
                        
                        L javaInstance = javaType.newInstance();
                        ......
                        return javaInstance;
                }



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to