axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chinmoy Chakraborty <cch...@gmail.com>
Subject Re: Axis2: Returning an Object as AnyType - get error
Date Mon, 11 May 2009 07:26:29 GMT
Hello,

I had the same problem when I tried to migrate Axis 1.4 to Axis2 1.4. Only
difference was in my case I was returning Object array (Object[] which was
2D array, array of arrays).

The developers said it works but it didn't work for me. the solution was to
use ComplexTypeArray. If you want to return a complextype, make a class and
use array of that class as return type. e.g. suppose i want to return names
and addresses of people, so i will make class People.

class People{
      String name;
      String address;
      int phone_number;
      etc..
}

and People[] will be return type and it works perfectly OK. In your case it
will work if you use specific type or complex type instead of Object.

Chinmoy



On Fri, May 8, 2009 at 7:27 PM, Boris Klug <boris@klg.de> wrote:

> Hi!
>
> We want to migrate a Axis 1.4 webservice to Axis2. The webservice is
> generated from a POJO Java class which contains a method like this:
>
>  public Object getData() {
>    return "a string";
>  }
>
> The WSDL generated by Axis2 looks like this:
>
> <xs:element name="getDataResponse">
>   <xs:complexType>
>     <xs:sequence>
>       <xs:element minOccurs="0"
>           name="return" nillable="true" type="xs:anyType"/>
>     </xs:sequence>
>   </xs:complexType>
> </xs:element>
>
> The client is generated from the wsdl using wsdl2java. When I test the web
> service with GetDataResponse gdr = stub.getData(); it generates the
> following exception:
>
> 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 package.MyServiceStub.fromOM(ZederbasicServiceStub.java:14738)
>
> The Object returned by getData() can be a String, Integer, Boolean or Date,
> no other types. All can be serialized by Axis2.
>
> In Axis 1.4 returning an Object was no problem. I search the mailing list
> but found no hint.
>
> Any ideas how I can get this to work?
>
> Thank you in advance.
>
>
> --
> Boris Klug, Koblenz, boris@klg.de, Fax: 0261-1334249
>

Mime
View raw message