Hello!
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
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 <[email protected]> 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, [email protected], Fax: 0261-1334249
--- original Nachricht Ende ----