ThiagoUriel
ThiagoUriel

Reputation: 115

Receiving a null BigDecimal from JAX-WS when client input is an invalid String

I'm developing a webservice using a WSDL (contract-first) that defines one of it's fields as a decimal type, which JAXB converts to a BigDecimal when generating client code.

So far so good. But when I'm testing with SoapUI, if I send an invalid String for this field (like "xxxx") I receive a null BigDecimal at server side. Works fine if I send a valid numeric value though.

I can't say this behavior makes no sense to me. The API might be getting a NumberFormatException, maybe from BigDecimal's Constructor, and just sending a null value to avoid throwing an exception before even reaches server-side.

But before I close this issue, I would like to confirm this behaviour or learn some "fix" that will let me handle the possible conversion error myself. So far I haven't found any documents regarding this scenario. Also, I wasn't able to find anything suspicious debugging the API.

Could you please help me with some directions? To maybe change this behavior or to certify it.

Thank you in advance.

Upvotes: 0

Views: 1290

Answers (1)

Kros
Kros

Reputation: 848

This is a problem that has to do with internationalization.

We also have a web service which expects a BigDecimal eg: 2.56.

One of our clients in Italy is sending 2,56. this is resulting in a null parameter being received. This is due to the fact that this client uses the italian locale.

Upvotes: 0

Related Questions