Decimal data is shown in a SOAP response message even though the input value was integer with the schema xs:decimal datatype.

Decimal data is shown in a SOAP response message even though the input value was integer with the schema xs:decimal datatype.

book

Article ID: KB0084734

calendar_today

Updated On:

Products Versions
TIBCO ActiveMatrix BusinessWorks -
Not Applicable -

Description

Resolution:
My service provider issues a schema with an element of type xs:decimal. However, it expects the value to be in integer form, e.g. "12", and not "12.0". Both formats are acceptable according to W3C. However, BW converts an input value of "12" to "12.0" when it show the value in SOAP messages.

Explanation:
      

Refer to the XML Schema Part 2: Data types Second Edition ( http://www.w3.org/TR/xmlschema-2/#decimal ). As you already know, Integer is a built-in data type which is derived from Decimal. So your earlier statement of "Both '12' and '12.0' are accepted by W3C for xs:decimal" is correct. Note that the Decimal data type has two representations:


<<<
3.2.3.1 Lexical representation

Decimal has a lexical representation consisting of a finite-length sequence of decimal digits (#x30-#x39) separated by a period as a decimal indicator. An optional leading sign is allowed. If the sign is omitted, "+" is assumed. Leading and trailing zeroes are optional. If the fractional part is zero, the period and following zero(es) can be omitted. For example: -1.23, 12678967.543233, +100000.00, 210.

3.2.3.2 Canonical representation

The canonical representation for decimal is defined by prohibiting certain options from the Lexical representation (§3.2.3.1)<http://www.w3.org/TR/xmlschema-2/#decimal-lexical-representation#decimal-lexical-representation>. Specifically, the preceding optional "+" sign is prohibited. The decimal point is required. Leading and trailing zeroes are prohibited subject to the following: there must be at least one digit to the right and to the left of the decimal point which may be a zero
>>>

What you have observed is the expected behavior of BW. The Canonical representation of a decimal requires a decimal point. We could see that "12.0" from the SOAP message does follow Canonical representation. If you want integer instead of decimal data from soap response message, you may have to define the data type to integer. Attached is a test case for reference (Filenbame: DecimalConversion.zip).

Issue/Introduction

Decimal data is shown in a SOAP response message even though the input value was integer with the schema xs:decimal datatype.

Attachments

Decimal data is shown in a SOAP response message even though the input value was integer with the schema xs:decimal datatype. get_app