generateWrappedArrayTypes is showing types as wrapped in the schema, but the 
serialized data send to the client is not wrapped.
-------------------------------------------------------------------------------------------------------------------------------

                 Key: AXIS2-4820
                 URL: https://issues.apache.org/jira/browse/AXIS2-4820
             Project: Axis2
          Issue Type: Bug
          Components: adb
    Affects Versions: 1.5.1
         Environment: Axis 2 1.5.1 + tomcat 5.5.29
java version "1.6.0_20"
Windows XP SP3
            Reporter: Paul Nibin K J
             Fix For: nightly


I am trying to deploy a web service which returns a complex bean object.

My Test web service class is


public class SimpleTest {

        public static class ComplexBean {
                public String[] getStr() {
                        return str;
                }

                public void setStr(String[] str) {
                        this.str = str;
                }

                public Object[][] getVal() {
                        return val;
                }

                public void setVal(Object[][] val) {
                        this.val = val;
                }

                private String[] str;
                private Object[][] val;
        }

        public ComplexBean getBean() {
                ComplexBean complexBean = new ComplexBean();
                complexBean.setStr(new String[] { "1", "2" });
                complexBean.setVal(new Object[][] { new Object[] { "1-a", "1-b" 
},
                                new Object[] { "2-a", "2-b" } });
                return complexBean;
        }
}

I deployed the service and the WSDL is generated. The schema for the generated 
WSDL is as follows:

<xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" 
targetNamespace="http://ws.apache.org/axis2/xsd";>
        <xs:complexType name="ComplexBean">
                <xs:sequence>
                        <xs:element maxOccurs="unbounded" minOccurs="0" 
name="str" nillable="true" type="xs:string"/>
                        <xs:element maxOccurs="unbounded" minOccurs="0" 
name="val" nillable="true" type="ax21:ArrayOfObject"/>
                </xs:sequence>
        </xs:complexType>
        <xs:complexType name="ArrayOfObject">
                <xs:sequence>
                        <xs:element maxOccurs="unbounded" minOccurs="0" 
name="array" nillable="true" type="xs:anyType"/>
                </xs:sequence>
        </xs:complexType>
</xs:schema>

I created the client for the WSDL using the ADB. I invoked the web method using 
the client. The web method is invoked and I captured the SOAP response. It is 
as follows.

<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope";>
        <soapenv:Body>
                <ns:getBeanResponse xmlns:ns="http://test";>
                        <ns:return 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:ax21="http://test/xsd"; xsi:type="ax21:ComplexBean">
                                <ax21:str>1</ax21:str>
                                <ax21:str>2</ax21:str>
                                <ax21:val>
                                        <ax21:array>1-a</ax21:array>
                                        <ax21:array>1-b</ax21:array>
                                </ax21:val>
                                <ax21:val>
                                        <ax21:array>2-a</ax21:array>
                                        <ax21:array>2-b</ax21:array>
                                </ax21:val>
                        </ns:return>
                </ns:getBeanResponse>
        </soapenv:Body>
</soapenv:Envelope>

But in the client side, I am getting an exception.

log4j:WARN No appenders could be found for logger 
(org.apache.axis2.description.AxisService).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" org.apache.axis2.AxisFault: 
org.apache.axis2.databinding.ADBException: Any type element type has not been 
given
        at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
        at test.SimpleTestStub.fromOM(SimpleTestStub.java:2463)
        at test.SimpleTestStub.getBean(SimpleTestStub.java:189)
        at test.TestSimpleClient.main(TestSimpleClient.java:12)
Caused by: java.lang.Exception: org.apache.axis2.databinding.ADBException: Any 
type element type has not been given
        at 
test.SimpleTestStub$ArrayOfObject$Factory.parse(SimpleTestStub.java:2411)
        at 
test.SimpleTestStub$ComplexBean$Factory.parse(SimpleTestStub.java:1729)
        at 
test.SimpleTestStub$GetBeanResponse$Factory.parse(SimpleTestStub.java:870)
        at test.SimpleTestStub.fromOM(SimpleTestStub.java:2457)
        ... 2 more
Caused by: org.apache.axis2.databinding.ADBException: Any type element type has 
not been given
        at 
org.apache.axis2.databinding.utils.ConverterUtil.getAnyTypeObject(ConverterUtil.java:1617)
        at 
test.SimpleTestStub$ArrayOfObject$Factory.parse(SimpleTestStub.java:2375)
        ... 5 more

Is this a known issue? Is this issue same as 
https://issues.apache.org/jira/browse/AXIS2-4439 ? Is there a patch available 
for this issue?

Anyways I tried the web service by setting the "generateWrappedArrayTypes" 
parameter as true in the services.xml. I found there is change in the WSDL 
generated.

<xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" 
targetNamespace="http://test/xsd";>
        <xs:complexType name="ComplexBean">
                <xs:sequence>
                        <xs:element name="strWrapper" nillable="true" 
type="ns:stringWrapper"/>
                        <xs:element name="valWrapper" nillable="true" 
type="ns:ArrayOfObjectWrapper"/>
                </xs:sequence>
        </xs:complexType>
        <xs:complexType name="stringWrapper">
                <xs:sequence>
                        <xs:element maxOccurs="unbounded" minOccurs="0" 
name="array" nillable="true" type="xs:string"/>
                </xs:sequence>
        </xs:complexType>
        <xs:complexType name="anyTypeWrapper">
                <xs:sequence>
                        <xs:element maxOccurs="unbounded" minOccurs="0" 
name="array" nillable="true" type="xs:anyType"/>
                </xs:sequence>
        </xs:complexType>
        <xs:complexType name="ArrayOfObject">
                <xs:sequence>
                        <xs:element name="arrayWrapper" nillable="true" 
type="ns:anyTypeWrapper"/>
                </xs:sequence>
        </xs:complexType>
        <xs:complexType name="ArrayOfObjectWrapper">
                <xs:sequence>
                        <xs:element maxOccurs="unbounded" minOccurs="0" 
name="array" nillable="true" type="ax21:ArrayOfObject"/>
                </xs:sequence>
        </xs:complexType>
</xs:schema>

But the SOAP Response that got send back was same as before with no change.
I was under the impression that SOAP Response send back also should be 
different. ( http://www.ibm.com/developerworks/library/ws-array/sidefile.html )

Again I generated the client using ADB itself. While invocation I got another 
exception.

log4j:WARN No appenders could be found for logger 
(org.apache.axis2.description.AxisService).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" org.apache.axis2.AxisFault: 
org.apache.axis2.databinding.ADBException: Unexpected subelement val
        at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
        at test.SimpleTestStub.fromOM(SimpleTestStub.java:1541)
        at test.SimpleTestStub.getBean(SimpleTestStub.java:189)
        at test.TestSimpleClient.main(TestSimpleClient.java:12)
Caused by: java.lang.Exception: org.apache.axis2.databinding.ADBException: 
Unexpected subelement val
        at 
test.SimpleTestStub$ComplexBean$Factory.parse(SimpleTestStub.java:1489)
        at 
test.SimpleTestStub$GetBeanResponse$Factory.parse(SimpleTestStub.java:870)
        at test.SimpleTestStub.fromOM(SimpleTestStub.java:1535)
        ... 2 more
Caused by: org.apache.axis2.databinding.ADBException: Unexpected subelement val
        at 
test.SimpleTestStub$ComplexBean$Factory.parse(SimpleTestStub.java:1483)
        ... 4 more

I could provide more information if required..



-- 
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