CXF client SOAP message formatting

Viewed 1044

The WSDL file I used to create the CXF client has this element definition:

<xsd:element name="Rate"> 
  <xsd:simpleType>
    <xsd:restriction base="xsd:decimal">
      <xsd:totalDigits value="18" />
      <xsd:fractionDigits value="2" />
    </xsd:restriction>
  </xsd:simpleType>
</xsd:element>

However when I try to send the SOAP message, number of digits in after decimal point exceeds the maximum value. For example I get 2.48862 while expecting 2.48. In order to solve this I was planning to implement a XmlAdapter to marshall the values, however I cannot map the element in WSDL to the client because onyl class of XmlAdapter is passed to field decleration as annotation.

@XmlJavaTypeAdapter(CustomXmlAdapter.class)

There seems to be no way to inform the XmlAdapter that field must have 2 digits after decimal point.

The number of fraction digits changes from element to element. I also don't have the access to change the WSDL.

Is there a way to format these elements while observing the number of decimal points specified in the WSDL?

1 Answers
Related