build a custom Serializer for primitive types ?
doesn't this look like a bug ?
especially since the line that throws the exception has the remark // FIXME! 
(org.apache.axis.message.RPCHandler:206)

-----Original Message-----
From: Stickley, Jim [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 27, 2002 4:11 PM
To: '[EMAIL PROTECTED]'
Subject: RE: Return a primitive type when java.lang.Object is expected


You may have to build a custom Serializer in Axis.

Jim Stickley
Birch Telecom
(816) 300-6743
[EMAIL PROTECTED]


-----Original Message-----
From: Oren Bar-El [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, June 26, 2002 9:23 AM
To: [EMAIL PROTECTED]
Subject: RE: Return a primitive type when java.lang.Object is expected

Hi Cyrus,

I think I managed to better understand the problem.
I get the error only when I use the method:
call.setReturnType(org.apache.axis.Constants.XSD_ANYTYPE), and I have to use
it if I want to name my parameters using the addParameter method.
does that make any sense ?

Oren.

-----Original Message-----
From: Hurst, Cyrus [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 26, 2002 5:05 PM
To: '[EMAIL PROTECTED]'
Subject: RE: Return a primitive type when java.lang.Object is expected


 Hello Oren,
     I have a java web-service that returns int ...The encoded response
looks something like:
   
<ns1:getAssociateIDFromDMZIDResponse
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; xmlns:ns1
="AssociateInfo">
   
    <getAssociateIDFromDMZIDReturn xsi:type="xsd:int">8002255
    </getAssociateIDFromDMZIDReturn>
  
</ns1:getAssociateIDFromDMZIDResponse>

  On the client I cast the returned object to Integer and it seems to work
fine ...


 -Cyrus 
-----Original Message-----
From: Oren Bar-El [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 26, 2002 9:56 AM
To: [EMAIL PROTECTED]
Subject: RE: Return a primitive type when java.lang.Object is expected


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 ????

Oren.
-----Original Message-----
From: Stickley, Jim [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 26, 2002 4:35 PM
To: '[EMAIL PROTECTED]'
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
            etc...


Jim Stickley
Birch Telecom
(816) 300-6743
[EMAIL PROTECTED]

-----Original Message-----
From: Oren Bar-El [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, June 26, 2002 2:38 AM
To: [EMAIL PROTECTED]
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 ?
Thanks,
Oren.

Reply via email to