You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Tibor Mucha (JIRA)" <ji...@apache.org> on 2012/08/20 12:48:38 UTC
[jira] [Commented] (AXIS2-5392) java BigDecimal defined as
type="xs:decimal" encodes in xml as engineering string
[ https://issues.apache.org/jira/browse/AXIS2-5392?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13437778#comment-13437778 ]
Tibor Mucha commented on AXIS2-5392:
------------------------------------
this task is simular to task AXIS2-4036 /but task AXIS2-4036 was not released/
> java BigDecimal defined as type="xs:decimal" encodes in xml as engineering string
> ----------------------------------------------------------------------------------
>
> Key: AXIS2-5392
> URL: https://issues.apache.org/jira/browse/AXIS2-5392
> Project: Axis2
> Issue Type: Bug
> Components: adb
> Affects Versions: 1.6.2
> Reporter: Tibor Mucha
> Attachments: AXIS2-5392.patch.txt
>
>
> The bigdecimal is encoded in soap xml as engineering string.
> Case:
> --- java WS object :
> public class DummyOutput {
> BigDecimal bd;
> public BigDecimal getBd() {
> return bd;
> }
> public void setBd(BigDecimal bd) {
> this.bd = bd;
> }
> }
> --- generated wsdl:
> <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://api.service.tis.ymsgroup.com/xsd">
> <xs:complexType name="DummyOutput">
> <xs:sequence>
> <xs:element minOccurs="0" name="bd" nillable="true" type="xs:decimal"/>
> <xs:element maxOccurs="unbounded" minOccurs="0" name="bdArray" nillable="true" type="xs:decimal"/>
> </xs:sequence>
> </xs:complexType>
> </xs:schema>
> --- Test case:
> public class DummyServices implements IDummyServices {
> public DummyOutput getArrayBigDecimal() {
> BigDecimal[] generateBigDecimalArray = generateBigDecimalArray();
> DummyOutput ret = new DummyOutput();
> ret.setBdArray(generateBigDecimalArray);
> ret.setBd(new BigDecimal("123E-10"));
> return ret;
> }
> private BigDecimal[] generateBigDecimalArray() {
> Random random = new Random();
> BigDecimal[] ret = new BigDecimal[10];
> for (int i = 0; i < ret.length; i++) {
> ret[i] = new BigDecimal("1E" + (random.nextBoolean() ? "+" : "-") + i);
> System.out.println(ret[i]);
> }
> return ret;
> }
> }
> --- the result is in engineering string:
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
> <soapenv:Body>
> <ns:getArrayBigDecimalResponse xmlns:ns="http://api.service.tis.ymsgroup.com">
> <ns:return xsi:type="ax2135:DummyOutput" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ax2135="http://api.service.tis.ymsgroup.com/xsd">
> <ax2135:bd>1.23E-8</ax2135:bd>
> <ax2135:bdArray>1</ax2135:bdArray>
> <ax2135:bdArray>1E+1</ax2135:bdArray>
> <ax2135:bdArray>1E+2</ax2135:bdArray>
> <ax2135:bdArray>1E+3</ax2135:bdArray>
> <ax2135:bdArray>1E+4</ax2135:bdArray>
> <ax2135:bdArray>0.00001</ax2135:bdArray>
> <ax2135:bdArray>0.000001</ax2135:bdArray>
> <ax2135:bdArray>1E-7</ax2135:bdArray>
> <ax2135:bdArray>1E-8</ax2135:bdArray>
> <ax2135:bdArray>1E-9</ax2135:bdArray>
> </ns:return>
> </ns:getArrayBigDecimalResponse>
> </soapenv:Body>
> </soapenv:Envelope>
> --- but expecting (to be compatible with soap not java receiver - in out case .NET):
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
> <soapenv:Body>
> <ns:getArrayBigDecimalResponse xmlns:ns="http://api.service.tis.ymsgroup.com">
> <ns:return xsi:type="ax2135:DummyOutput" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ax2135="http://api.service.tis.ymsgroup.com/xsd">
> <ax2135:bd>0.0000000123</ax2135:bd>
> <ax2135:bdArray>1</ax2135:bdArray>
> <ax2135:bdArray>10</ax2135:bdArray>
> <ax2135:bdArray>100</ax2135:bdArray>
> <ax2135:bdArray>1000</ax2135:bdArray>
> <ax2135:bdArray>10000</ax2135:bdArray>
> <ax2135:bdArray>0.00001</ax2135:bdArray>
> <ax2135:bdArray>0.000001</ax2135:bdArray>
> <ax2135:bdArray>0.0000001</ax2135:bdArray>
> <ax2135:bdArray>0.00000001</ax2135:bdArray>
> <ax2135:bdArray>0.000000001</ax2135:bdArray>
> </ns:return>
> </ns:getArrayBigDecimalResponse>
> </soapenv:Body>
> </soapenv:Envelope>
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org