axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tibor Mucha (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (AXIS2-5392) java BigDecimal defined as type="xs:decimal" encodes in xml as engineering string
Date Mon, 20 Aug 2012 10:50:37 GMT

     [ https://issues.apache.org/jira/browse/AXIS2-5392?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Tibor Mucha updated AXIS2-5392:
-------------------------------

    Environment: JDK 1.5.0
    
> 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
>         Environment: JDK 1.5.0
>            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


Mime
View raw message