NAV Webservice in different language / date format

mboon75mboon75 Member Posts: 16
edited 2013-06-07 in NAV Three Tier
Hi,

I have implemented a Codeunit webservice in NAV2009 and passing a date as an argument to a method. I would like to have influence in what format the date is handled and i was assuming that the dutch language module could help me out. But that seems not the case.

I have changed the regional settings for the user that runs the NAV Server + Nav Server Webservice. but still same error.
The error i get:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <soap:Fault>
      <faultcode xmlns:q0="urn:microsoft-dynamics-schemas/error">q0:Microsoft.Dynamics.Nav.Types.Exceptions.NavCSideException</faultcode>
      <faultstring xml:lang="en-US">'13-11-2014' is not a valid date.</faultstring>
      <detail>
        <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">'13-11-2014' is not a valid date.</string>
      </detail>
    </soap:Fault>
  </soap:Body>
</soap:Envelope>

Is there a way that i can set the culture information like webservice in IIS can have?
<globalization culture="nl-NL" uiCulture="nl-NL"/>

ANy other ideas how to fix this thing?

Comments

  • mboon75mboon75 Member Posts: 16
    In my previous post i was not correct.

    I'm not passing a date as argument but a text.

    I have a simple codeunit
    with a method ConvertToDate
    ConvertToDate(DateText : Text[30]) returndate : Date
    EVALUATE(returndate, DateText);
    

    I exposed the codeunit as a webservice called ConvertDate. When i call the method in a .Net application then i get the error when i post the date "13-11-2014".
    ConvertDate cd = new ConvertDate();
                cd.UseDefaultCredentials = true;
                try
                {
                    DateTime dt = cd.ConvertToDate(DatumBox.Text);
                    DatumBox.Text = dt.ToShortDateString();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
    
    The fun is when you submit a date "11-1-2009" then the above code is toggling the date. The outcome is DatumBox (which is a TextBox) contains "1-11-2009".

    I run the NAV Server Tier under my own account, so regional settings are dutch. It seems the service tier does not take the regional settings of the user who runs the service.

    Anymore ideas?
  • mboon75mboon75 Member Posts: 16
    thanks to Goncalo from MS Support, i have the solution to this issue.

    Make an entry in Tabel User Personalization (2000000073) for the user that runs the NAV Server.

    Set there the language to the desired language. The EVALUATE is then working fine too with the proper date format.

    So, it is not considering the Regional Settings.
  • MatthiasKönigMatthiasKönig Member Posts: 14
    thx for the solution for the date problem.

    but I have another Problem:

    My webservice only add an item comment and must send the NAV default error message to the outstanding application.
    If the item does not exist, the user must get the error message in his language.
    Now I use the tipp of mboon75 and the caption of the field "Item No." is translated (German: "Artikel Nr."). But the rest of the default error message is still english?!
    ---------------------------
    Artikel Nr. 'A' does not exist.
    ---------------------------
    OK   
    ---------------------------
    

    has someone a rease for this? or better a solution?
  • mboon75mboon75 Member Posts: 16
    This is indeed strange.
    What is the NAV code that is executed?
    The text constant is translated?
  • MatthiasKönigMatthiasKönig Member Posts: 14
    sry for my late response :)

    this is an internal error message, not an programmed error(''); :/
  • deV.chdeV.ch Member Posts: 543
    I'am not sure but this could be a problem because the nav server has no german language pack. Generally, application messages, labesl (on client) etc are stored in the localized language pack. Try coping the DES folder of your RTC client to the Nav server
  • BeliasBelias Member Posts: 2,998
    same here!http://www.mibuso.com/forum/viewtopic.php?f=32&t=58051&view=unread#unread
    sorry for cross posting but i didn't find this error before.
    Obviously, i've already checked all the language pack folders.
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • PConijnPConijn Member Posts: 31
    What I generally do in SOAP/XML is pass the date in xml format (yyyy-MM-dd), so 2014-11-13. In the EVALUATE, you can then also indicate that format:
    EVALUATE(returndate, DateText, 9);
    

    The 9 argument tells the EVALUATE function to look for xml-standard formats. It's a good way to keep things like dates and times language-independent.
    Kind Regards,

    Peter Conijn

    -The Learning Network-

Sign In or Register to comment.