You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@xml.apache.org by Deane Sloan <De...@equinox.co.nz> on 2001/05/01 04:41:01 UTC
RE: Integer-Class mapped to atomic int??
Hi Alex et al,
This is an issue also with Apache SOAP 2.1.
Apache SOAP Serializes Java intrinsic types and primitive Classes both as
the representative SOAP intrinsic type. For example, Java's int and Integer
are both serialized as SOAP's int.
By default they are reincarnated as the Java intrinsic type ( the above case
would reserialize as a Java int by default).
This situation isn't an issue when using the BeanSerializer for beans
containing intrinsic/primitive types, as Java reflection automatically
performs the conversion between the primitive and intrinsic as needed on the
Bean's property set method call.
However it is a problem (as you note) with the actual RPC parameters to the
provider method - with the MethodUtils.java being the chief culprit
(polymorhpic argument checking backfiring in this case).
Make a choice - change the default mappings to use the primitive class when
unmarshalling (as exemplified below) or change your method definitions to
use the intrinsic type. I'd stay away from serializing the prmitive class
types in their own namespace - as this would really limit interoperability.
To change this default behaviour, you'll need to change the default
*deserializer* for the type in the server-side mapping registry, using your
deployment descriptor (mappings section):
<isd:map
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:x="http://www.w3.org/1999/XMLSchema"
qname="x:int"
javaType="java.lang.Integer"
xml2JavaClassName="org.apache.soap.encoding.soapenc.IntObjectDeserializer"/>
You may also need to change it in the client's mapping registry (for return
types?), using code such as:
smr.mapTypes(
Constants.NS_URI_SOAP_ENC,
new QName(Constants.NS_URI_SCHEMA_XSD, "int"),
Integer.class, null, new IntObjectDeserializer()
);
(Both of these samples still use the default serializer, intentionally to
maintain interoperability)
Best Regards,
Deane Sloan
-----Original Message-----
From: ahomburg@intermediate.de [mailto:ahomburg@intermediate.de]
Sent: Tuesday, 1 May 2001 02:49
To: soap-user@xml.apache.org
Subject: Integer-Class mapped to atomic int??
Problem with Integer-Class using Apache-Soap 2.0
I have a service with the method putNumber( Integer aNumber ). On the
Client-Side I set the Parameter as follows:
params.addElement( new Parameter( "aNumber", Integer.class, num, null
));
The xml looks like this:
<aNumber xsi:type="xsd:int">17</aNumber>
However, SOAP seems to map my Integer-Class to an atomic int-Value and
returns this fault:
Fault= SOAP-ENV:Server, RemoteHT.putNumber(int) -- no signature match
null
Is there a common Problem known, or am I doing something wrong????
Alex
---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org