[ 
https://issues.apache.org/jira/browse/AXIS2-3797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12627287#action_12627287
 ] 

Amila Chinthaka Suriarachchi commented on AXIS2-3797:
-----------------------------------------------------

When generating code with the wsdl2java tool it takes inputs only from the wsdl 
file. So if there is an element of the type anyType it generates an object type 
parameter for this. xsd:anyType is the parent type for all XmlSchema types as 
java.lang.Object for java objects.

eg.
<complexType>
            <sequence>
                <element name="testValue" type="xsd:anyType" minOccurs="0" 
nillable="true"/>
            </sequence>
        </complexType>

Here you can give any standard java class so that it serialize it with the type.

eg. <testValue xsi:type="xsd:int">5</testValue>

so at the other end it can creates the proper objects depends on the type.

But if you have a schema like this

<complexType>
            <sequence>
                <any/>
            </sequence>
        </complexType>

then ADB generates an OMElement for the corresponding parameter and hence you 
can parse an OMElement.

Here you can assume that the wsdl2java tool is something which try to generate 
a code, so that the generated code serialize java objects and parse xmlstreams 
according to the schema given in the wsdl. It does not have an idea about the 
implementation logic of the service.



> "Unknown type can not serialize" Exception
> ------------------------------------------
>
>                 Key: AXIS2-3797
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3797
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: adb
>    Affects Versions: 1.4
>         Environment: Axis2 1.4, Tomcat 5.5.26
>            Reporter: Detelin Yordanov
>            Assignee: Amila Chinthaka Suriarachchi
>         Attachments: full stacktrace.txt, TypeTest.aar, TypeTestClient.java
>
>
> I have a simple POJO service with the following method:
> package org.tempuri.test;
> import org.tempuri.test.data.arrays.ArrayOfanyType;
>  
> public class TypeTest {
>     public ArrayOfanyType retArrayAnyType1D(ArrayOfanyType inArrayAnyType1D) {
>         return inArrayAnyType1D;
>     }
> }
> The ArrayOfanyType is declared like this:
> public class ArrayOfanyType {
>     private Object[] anyType;
>     public Object[] getAnyType() {
>         if (anyType == null) {
>             anyType = new Object[0];
>         }
>         return this.anyType;
>     }
>     public void setAnyType(Object[] anyType) {
>       this.anyType = anyType;
>     }
> }
> I deploy this POJO on an Axis2 1.4 runtime running on Tomcat.
> Then I generate a client stub using the following command:
> wsdl2java -ap -o ./generated -s -u -uw -uri 
> http://localhost:8080/axis2-1.4/services/TypeTest?wsdl
> I use the stub to invoke the service passing an OMElement in the Object array:
> OMFactory factory = OMAbstractFactory.getOMFactory();
> OMNamespace ns = 
> factory.createOMNamespace("http://www.serverside.com/articles/introducingAxiom";,
>  "article");
> OMElement articleElement = factory.createOMElement("Article", ns);
> ArrayOfanyType input = new ArrayOfanyType();
> input.setAnyType(new OMElement[]{articleElement});
> stub.retArrayAnyType1D(input);
> While serializing the ArrayOfanyType ADBBean I get an "Unknown type can not 
> serialize" exception:
> Caused by: javax.xml.stream.XMLStreamException: Unknow type can not serialize
>       at 
> org.apache.axis2.databinding.utils.ConverterUtil.serializeAnyType(ConverterUtil.java:1449)
>       at 
> org.tempuri.test.data.arrays.xsd.ArrayOfanyType.serialize(ArrayOfanyType.java:241)
>       at 
> org.tempuri.test.data.arrays.xsd.ArrayOfanyType.serialize(ArrayOfanyType.java:160)
>       at 
> org.tempuri.test.RetArrayAnyType1D.serialize(RetArrayAnyType1D.java:203)
>       at 
> org.tempuri.test.RetArrayAnyType1D.serialize(RetArrayAnyType1D.java:123)
>       at 
> org.tempuri.test.RetArrayAnyType1D$1.serialize(RetArrayAnyType1D.java:111)
> ...
> I did not have this problem on Axis2 1.3 so I guess something have been 
> changed in ConverterUtil.

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