mibuso.com

Microsoft Business Solutions online community
It is currently Sat Aug 02, 2014 4:25 am

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: User Regional Settings vs NAV2009 Web Service problem
PostPosted: Thu Dec 22, 2011 6:19 pm 
Offline

Joined: Fri Jan 30, 2009 3:19 pm
Posts: 41
Location: Donostia
Country: Spain (es)
Hi everybody!

I'm facing a problem to validate Dates and Decimals format from users with Regional Settings different than Web Service Regional Settings.
The users in our system could have several Regional Settings (ES, FR, BG, EN, etc) and they are sending information to my NAV2009 WS which is on a server with Regional Settings = EN. So when a user send an amount like 1.000 (a thousand in ES), the EVALUATE in the WS validates it as 1,00 (one in EN).
Same problem with Dates that could be DMY or YMD, and on my WS validates MDY.

I tried the User Personalization solution that is related to other topic in here, but it didn't work.
The NAV version is NAV 2009 R2 (6.00.32900).

How can I solve this problem?
Had it happen this problem to some of you?

Many thanks in advance!!


Top
 Profile E-mail WWW  
 
 Post subject: Re: User Regional Settings vs NAV2009 Web Service problem
PostPosted: Fri Dec 23, 2011 2:10 pm 
Offline

Joined: Mon Aug 17, 2009 1:48 pm
Posts: 14
The post viewtopic.php?f=32&t=38402 discusses about similar confusion around date format. Please take a look.


Top
 Profile E-mail  
 
 Post subject: Re: User Regional Settings vs NAV2009 Web Service problem
PostPosted: Tue Jan 03, 2012 5:42 pm 
Offline

Joined: Tue May 24, 2005 3:08 pm
Posts: 25
Location: Italia
Country: Italy (it)
I too am still looking for a solution to the problem.
The problem is that from hotfix 32558, the web service works only in English and no longer consider the "User table Personalization (2000000073)".

Is there a solution?

_________________
God does not play dice with the universe. [Albert Einstein]


Top
 Profile  
 
 Post subject: Re: User Regional Settings vs NAV2009 Web Service problem
PostPosted: Tue Jan 03, 2012 6:17 pm 
Offline
MVP Microsoft Dynamics NAV

Joined: Tue Sep 02, 2008 8:37 am
Posts: 4577
Location: Hyderabad
Country: India (in)
Check whether this link helps or not..
http://blogs.msdn.com/b/nav/archive/2011/10/03/en-us-as-web-services-default-language.aspx

_________________
-Mohana
http://mibuso.com/blogs/mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav


Top
 Profile  
 
 Post subject: Re: User Regional Settings vs NAV2009 Web Service problem
PostPosted: Tue Jan 03, 2012 6:29 pm 
Offline

Joined: Tue May 24, 2005 3:08 pm
Posts: 25
Location: Italia
Country: Italy (it)
mohana_cse06 wrote:


Yes, the problem is just that.
The web service recognizes and responds only to EN-US!

Is there a solution to this problem?

_________________
God does not play dice with the universe. [Albert Einstein]


Top
 Profile  
 
 Post subject: Re: User Regional Settings vs NAV2009 Web Service problem
PostPosted: Wed Jan 11, 2012 10:15 am 
Offline

Joined: Thu Oct 30, 2008 10:38 am
Posts: 1005
Location: Earth
Country: Netherlands (nl)
Why don't you use language independent formatted data?
Or is modifying code on the sending party side a problem?
For Date you can use the xml-formatted date.
For decimals you can check if the point comes before the comma.
And if it does, you know what the thousand seperator is, remove it, than replace the comma and point with the decimal seperator of the system. OR remove all seperators, send it as a string formatted as iiiiiiiiiiiiiiiddddd with i the integer part and d the decimal part: this way 6.022,56 and 6,022.56 would be :
check:
Code: Select all
if strpos(amount,'.') <>0 and strpos(amount,',') <> 0 then
  if strpos(amount,'.')>strpos(amount,',') then
      delstr(amount,'.') else delstr(amount,',')

Would turn out 6022,56|6022.56. Then you replace point and comma with the local decimal seperator (always . in code)
or formatted 6.022,56 would be 602256000 (5 decimal points in this example)

_________________
|Pressing F1 is so much faster than opening your browser|
|MCBMSS: 5.0 intro|MCTS:NAV09 839..841|JetReports© Certified Specialist|
|Dynamics Anywhere: Mobile Business Solutions|


Top
 Profile  
 
 Post subject: Re: User Regional Settings vs NAV2009 Web Service problem
PostPosted: Wed Jan 11, 2012 12:34 pm 
Offline
MVP Microsoft Dynamics NAV
NAV TechDays 2014 attendee

Joined: Thu Mar 13, 2008 10:50 pm
Posts: 52
Location: Croatia
Country: Croatia (hr)
Why are you doing EVALUATE in the first place? If the variable you are passing to WS is known to be date, then you should not pass it as Text. In that case, the format doesn't matter, because the variable will be stongly typed at caller end as well, and you will not have any issues with regional settings on client side, or the fact that WS always uses EN-US.

Another approach, which is ugly, but will work, is to do something like this:

Code: Select all
IF (NOT GUIALLOWED) AND ISSERVICETIER THEN
  GLOBALLANGUAGE := xyz;


in your CompanyOpen trigger in Codeunit 1. You can make it smart and make it read from User Personalization table, or somewhere else.

_________________
(Co-)author of "Implementing Microsoft Dynamics NAV 2009"
http://navigateintosuccess.com/


Top
 Profile  
 
 Post subject: Re: User Regional Settings vs NAV2009 Web Service problem
PostPosted: Wed Jan 11, 2012 3:01 pm 
Offline

Joined: Tue Jun 21, 2011 1:39 pm
Posts: 548
Country: Netherlands (nl)
Ok, so when you have used this update. All current webservices will change to US and will stop working if the connecting application still sends NL dates? What then about option fields? Im not sure what the implecations are?


Top
 Profile E-mail  
 
 Post subject: Re: User Regional Settings vs NAV2009 Web Service problem
PostPosted: Wed Jan 11, 2012 3:34 pm 
Offline
MVP Microsoft Dynamics NAV
NAV TechDays 2014 attendee

Joined: Thu Mar 13, 2008 10:50 pm
Posts: 52
Location: Croatia
Country: Croatia (hr)
That's not true. This update will only affect strings (texts). If you send a string over to NAV, and that string contains e.g. a date, and then you want to EVALUATE that into a date field, NAV will presume it was in EN-US format. However, if you have a date field, and you populate it with a date value, then call the web service, it will work just as nice as it worked before this update.

The same goes for dates, integers, decimals, options... As long as you are strongly typed on NAV side (as opposed to passing texts around), you are on the safe side.

_________________
(Co-)author of "Implementing Microsoft Dynamics NAV 2009"
http://navigateintosuccess.com/


Top
 Profile  
 
 Post subject: Re: User Regional Settings vs NAV2009 Web Service problem
PostPosted: Wed Jan 11, 2012 4:45 pm 
Offline

Joined: Tue Jun 21, 2011 1:39 pm
Posts: 548
Country: Netherlands (nl)
Vjeko wrote:
That's not true. This update will only affect strings (texts). If you send a string over to NAV, and that string contains e.g. a date, and then you want to EVALUATE that into a date field, NAV will presume it was in EN-US format. However, if you have a date field, and you populate it with a date value, then call the web service, it will work just as nice as it worked before this update.

The same goes for dates, integers, decimals, options... As long as you are strongly typed on NAV side (as opposed to passing texts around), you are on the safe side.


Ok thanks for the info. Was a bit scared of the new hotfix. :-#


Top
 Profile E-mail  
 
 Post subject: Re: User Regional Settings vs NAV2009 Web Service problem
PostPosted: Thu Jan 12, 2012 12:51 pm 
Offline

Joined: Fri Jan 30, 2009 3:19 pm
Posts: 41
Location: Donostia
Country: Spain (es)
Vjeko wrote:
Why are you doing EVALUATE in the first place? If the variable you are passing to WS is known to be date, then you should not pass it as Text. In that case, the format doesn't matter, because the variable will be stongly typed at caller end as well, and you will not have any issues with regional settings on client side, or the fact that WS always uses EN-US.

Another approach, which is ugly, but will work, is to do something like this:

Code: Select all
IF (NOT GUIALLOWED) AND ISSERVICETIER THEN
  GLOBALLANGUAGE := xyz;


in your CompanyOpen trigger in Codeunit 1. You can make it smart and make it read from User Personalization table, or somewhere else.



Many thanks for the response, but is not worthy for me...
I tried to use GLOBALLANGUAGE but it doesn't work.
I agree about the strongly typed is the best we can use, but I can't use it in my development. I'm trying to send an XML to a NAV WS, but the NAV WS does not allow complex types as parameters, so I use a Bigtext in order to send the "XML" as valid type of parameter. Then I cannot type the values in the WS because everything is a text. I use a CDATA in order to pass the XML as a string.

WS Function:
ImportLiquidation(parXML : BigText) : Text[1024]
...

How can I validate the WSDL when i receive an XML as bigtext format?

Find attached part of my NAV WSDL.


Attachments:
2012-01-12_115024.jpg
2012-01-12_115024.jpg [ 105.7 KiB | Viewed 3743 times ]
Top
 Profile E-mail WWW  
 
 Post subject: Re: User Regional Settings vs NAV2009 Web Service problem
PostPosted: Thu Jan 12, 2012 1:40 pm 
Offline
MVP Microsoft Dynamics NAV
NAV TechDays 2014 attendee

Joined: Thu Mar 13, 2008 10:50 pm
Posts: 52
Location: Croatia
Country: Croatia (hr)
JAJ wrote:
Many thanks for the response, but is not worthy for me...
I tried to use GLOBALLANGUAGE but it doesn't work.
I agree about the strongly typed is the best we can use, but I can't use it in my development. I'm trying to send an XML to a NAV WS, but the NAV WS does not allow complex types as parameters, so I use a Bigtext in order to send the "XML" as valid type of parameter. Then I cannot type the values in the WS because everything is a text. I use a CDATA in order to pass the XML as a string.

WS Function:
ImportLiquidation(parXML : BigText) : Text[1024]
...

How can I validate the WSDL when i receive an XML as bigtext format?

Find attached part of my NAV WSDL.


Are you using NAV 2009 R2? If so, you could use .NET interop here. Have an object which has strongly typed data - serialize it as XML on client side, pass that XML to a Web service, then deserialize it from XML using .NET interop, and you have your strongly typed data back again, without worrying about regional settings.

_________________
(Co-)author of "Implementing Microsoft Dynamics NAV 2009"
http://navigateintosuccess.com/


Top
 Profile  
 
 Post subject: Re: User Regional Settings vs NAV2009 Web Service problem
PostPosted: Tue Jan 24, 2012 12:33 pm 
Offline

Joined: Fri Jan 30, 2009 3:19 pm
Posts: 41
Location: Donostia
Country: Spain (es)
Vjeko wrote:

Are you using NAV 2009 R2? If so, you could use .NET interop here. Have an object which has strongly typed data - serialize it as XML on client side, pass that XML to a Web service, then deserialize it from XML using .NET interop, and you have your strongly typed data back again, without worrying about regional settings.


Thanks a lot for your reponse Vjeko.
Yes, I'm using Dynamics NAV R2.
I agree with your solution. I'm going to implement it. But may be I need a bit help with the .NET object that I have to use and the way to use it.(But not the use .NET interoperability in Dynamics NAV)
Could you show me a little example,please? :D

Thanks in advance.


Top
 Profile E-mail WWW  
 
 Post subject: Re: User Regional Settings vs NAV2009 Web Service problem
PostPosted: Tue Feb 14, 2012 6:03 pm 
Offline
MVP Microsoft Dynamics NAV
NAV TechDays 2014 attendee

Joined: Thu Mar 13, 2008 10:50 pm
Posts: 52
Location: Croatia
Country: Croatia (hr)
JAJ wrote:
Thanks a lot for your reponse Vjeko.
Yes, I'm using Dynamics NAV R2.
I agree with your solution. I'm going to implement it. But may be I need a bit help with the .NET object that I have to use and the way to use it.(But not the use .NET interoperability in Dynamics NAV)
Could you show me a little example,please? :D

Thanks in advance.


JAJ, sorry - I was busy lately, so I've completelly missed this extra question of yours. Did you manage to solve it? Please check in Mibuso download sections, and look for downloads of sessions from NAV Tech Days conference - there is my session on .NET interop with a ton of examples. Also, you have a post or two about that on my blog, search a bit. If you still don't know what exactly you need to do, then reply here, and I'll make a short example to help you.

_________________
(Co-)author of "Implementing Microsoft Dynamics NAV 2009"
http://navigateintosuccess.com/


Top
 Profile  
 
 Post subject: Re: User Regional Settings vs NAV2009 Web Service problem
PostPosted: Tue Feb 14, 2012 7:21 pm 
Offline
MVP Microsoft Dynamics NAV

Joined: Tue Sep 02, 2008 8:37 am
Posts: 4577
Location: Hyderabad
Country: India (in)
Did you check this?
http://blogs.msdn.com/b/nav/archive/2012/02/06/ws-on-a-multilanguage-environment.aspx

_________________
-Mohana
http://mibuso.com/blogs/mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: