axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oren Bar-El" <>
Subject RE: Return a primitive type when java.lang.Object is expected
Date Wed, 26 Jun 2002 13:55:57 GMT
thanks for the response Jim, but...
the service that returns the data is a .net server, so I can't really control it.
the exception is thrown from Call.invoke (before it reaches my code) when it discovers that
the returned type is int.
where can I wrap the returned type ????

-----Original Message-----
From: Stickley, Jim []
Sent: Wednesday, June 26, 2002 4:35 PM
To: ''
Subject: RE: Return a primitive type when java.lang.Object is expected

You can not return a primitive type as a java.lang.Object, you will need to wrap it in one
of the java.lang type classes, i.e.


            Primitive type     java.lang type

            -------------------     -----------------------

            int                     java.lang.Integer

            long                  java.lang.Long

            double               java.lang.Double




Jim Stickley

Birch Telecom

(816) 300-6743


-----Original Message-----
From: Oren Bar-El [] 
Sent: Wednesday, June 26, 2002 2:38 AM
Subject: Return a primitive type when java.lang.Object is expected


Hi All,

I am new with Axis, and trying to evaluate it for my company.

The first test I made was to build a Microsoft.NET web service, and try to consume it with
Apache Axis.

The web service has one method that returns an object. 

When the actual returned type is String, it works fine, but when I try to return a primitive
type (like int or boolean), I get an Exception ("org.xml.sax.SAXException: Bad types (int
->class java.lang.Object)").

I saw that Call.invoke has a overloaded method that accepts and returns a SOAPEnvelope, but
I don't really like to build my own SOAPEnvelope.

I tried this with and without WSDL2Java proxies, and got the same error.

Anybody has a solution ?



View raw message