axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Raghu Upadhyayula" <>
Subject RE: Re: Axis2: Returning an Object as AnyType - get error
Date Mon, 11 May 2009 14:18:33 GMT
Hi Boris,


You can have the return type as OMElement.  With that you can return
anything you want (it could be a string, date, Boolean or something


You'll define it in WSDL like this.


                    <any namespace="##targetNamespace" minOccurs="0"





From: Boris Klug [] 
Sent: Monday, May 11, 2009 2:44 AM
To: Chinmoy Chakraborty;
Subject: Re: Re: Axis2: Returning an Object as AnyType - get error



Thank you for your suggestion. I have done it in another case where I
had to return an array of data holder objects. 

Here I realy want to return a String, Integer, Date or Boolean. What I
cant do - but that would be realy ugly - is to create a class like

class ReturnValue {
  public String aString;
  public Integer aInteger;
  public Boolean aBoolean;

and only set the value of the type I want to return. It would work - but
its ugly.

So some other hints?

----- original Nachricht --------

Betreff: Re: Axis2: Returning an Object as AnyType - get error
Gesendet: Mo, 11. Mai 2009
Von: Chinmoy Chakraborty



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;




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.





On Fri, May 8, 2009 at 7:27 PM, Boris Klug <> wrote:


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:element minOccurs="0"
          name="return" nillable="true" type="xs:anyType"/>

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(
   at package.MyServiceStub.fromOM(

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,, Fax: 0261-1334249

--- original Nachricht Ende ----

View raw message