Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 89686 invoked from network); 6 Sep 2009 20:30:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 6 Sep 2009 20:30:29 -0000 Received: (qmail 99052 invoked by uid 500); 6 Sep 2009 20:30:29 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 98951 invoked by uid 500); 6 Sep 2009 20:30:28 -0000 Mailing-List: contact axis-dev-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-dev@ws.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-dev@ws.apache.org Received: (qmail 98942 invoked by uid 99); 6 Sep 2009 20:30:28 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 06 Sep 2009 20:30:28 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 06 Sep 2009 20:30:18 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 9290A234C055 for ; Sun, 6 Sep 2009 13:29:57 -0700 (PDT) Message-ID: <923200960.1252268997599.JavaMail.jira@brutus> Date: Sun, 6 Sep 2009 13:29:57 -0700 (PDT) From: "Andreas Veithen (JIRA)" To: axis-dev@ws.apache.org Subject: [jira] Updated: (AXIS2-3797) "Unknown type can not serialize" Exception In-Reply-To: <45050281.1210755595606.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/AXIS2-3797?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Andreas Veithen updated AXIS2-3797: ----------------------------------- Assignee: (was: Andreas Veithen) > My interpretation of any type is it has to map to an object. And at runtime this object can have a simple type or an complex type. i.e. generated ADB bean object in ADB case. > > eg. > if there this and xml schema part like this > > > then In my interpretation anyType is like java.lang.Object. All classes are extend from Object class. In Java, classes are derived from java.lang.Object by extension. On the other hand, schema types are derived from anyType by restriction. They are therefore not comparable. > when you use anyType for an element it is like using Object type for an java field. At runtime the element can have any type but the type should be a defined one. The XML schema specs clearly say that an element declared with anyType can have any content, and this content is not necessarily described by an existing type. What you are describing here is not anyType, but (for which ADB actually uses OMElement, while this should be represented as a Java object). > And hence you should have a value to xsi:type. > I Agree with you that what schema says is ambiguous. I don't pretend that the schema specs are ambiguous. They are very clear and they make sense if one avoids comparing the schema type system (which works by restriction and extension) with the Java type system (which only works by extension). > This is the only interpretation I can come up with to write a possible > implementation. In this way I could interoperate the anyType with the MSFT wsdl where with OMElement it was not possible. As I said above, supporting xsi:type correctly is a real improvement, but on the other hand, considering xsi:type as mandatory is a regression. IMHO the correct approach is as follows: - The property storing the anyType element should be of type Object. - During deserialization: - If xsi:type is present, map the content to a Java object. - Otherwise, map it to an OMElement. - During serialization: - If the property refers to an OMElement, serialize this element and don't add xsi:type. - Otherwise, map the Java object to a schema type and serialize it with an xsi:type attribute. > "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 > 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.