Last post Jan 16, 2013 09:24 PM by Rawler
Jan 14, 2013 03:46 PM|Rawler|LINK
I have this Web Service that recieves like 20 parameters, two of them are Decimal.
When I run the ws at visual studio at those 2 decimal parameters I write "150.56" and "3580.88" and all goes good. But when I test the ws with the WCF Test Client, those values becomes from "150.56" to "15056" and "3580.88" to "358088". I read it could be
the culture, but I don't know how to solve this.
Thanks to all!
Jan 14, 2013 03:51 PM|Rion Williams|LINK
Your precision value is likely set too high. When precision is greater than 28 for decimals, then by default an XML data-type is used to store the value.
//Using precision > 28
150.56 => 15056
//Using precision <= 28
150.56 => 150.56
You can find a large discussion of the issue
Jan 14, 2013 04:26 PM|Rawler|LINK
Those fields are set Decimal(16, 2) and Decimal(8, 4).
And it does work at vs2010 environment, but at WCF Test Client is when all is messed up.
Jan 14, 2013 04:46 PM|Rion Williams|LINK
The following Stack Overflow thread discusses a similar issue that relates to the culture / regional settings (as you had mentioned before).
One of the user's explicitly defined the "." as the seperator for numbers and was able to test his WCF services successfully, so it may be worth a shot. (Unless the Test Client by default reads in all data-types as XML)
Jan 15, 2013 08:53 AM|Rawler|LINK
Thanks for the link, I will try changing the separator for numbers, but still if another user wants to use it, should change the configuration aswell?
There should be a .net fix for this, I mean I can't tell every user to change their configuration each time they need to use my WS.
Jan 15, 2013 09:06 AM|Rion Williams|LINK
As you mentioned this only appeared to be a problem within the Test Client and not the actual implementation right?
(If it is just an issue with the test client - then you should be alright if I understand you correctly.)
Jan 15, 2013 09:34 AM|Rawler|LINK
I just tested the web service from the browser and it worked. This web service is being invoked from a desktop application, I will check for the configured number separator. So there should be a config file at WCF Test Client to change or configure this?
Jan 15, 2013 09:39 AM|Rion Williams|LINK
The following Stack Overflow thread discusses the process for disabling autogenerating a configuration file for the WCF Test Client so that you could edit and re-use the same one for all of your subsequent requests :
Here's another long discussion on the same topic in the MSDN forums as well.
Jan 16, 2013 09:24 PM|Rawler|LINK
Thanks for the links, I'll check them at work.