webservice - companyname with special characters

drdr Member Posts: 11
edited 2009-04-22 in NAV Three Tier
the documentation says for a page-webservice that the url is [url=http://]http://[/url]<Server>:<WebServicePort>/<ServerInstance>/WS/<CompanyName>/Page/<ServiceName&gt;
an example with cronus shows me something like http://localhost:7047/DynamicsNAV/WS/CR ... e/Customer

but i have a company with some special characters (like: Xyz GmbH & Co. KG) and i can't reach the webservice. where is the documentation for proper encoding? its not "normal" url encoding, because whitespaces become underscores and not "%20". what to do with the "&" and maybe the "."??

hope for some help,
daniel

Answers

  • matttraxmatttrax Member Posts: 2,309
    I'll assume you tried underscores? :D
  • drdr Member Posts: 11
    sure. i used the underscores for whitespaces like "Xyz_GmbH_&_Co._KG" but it did not work and i used underscores for the other special characters but it did not work and tried some other things that did not work...
  • kinekine Member Posts: 12,562
    the dots are replaced by underscores too, AND if there are two underscores, they are replaced by only one in the result. But To be sure which companies you can call, you can use the system webservice to read the list of available companies and there you have exact values for calling the WS. 8)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • freddy.dkfreddy.dk Member, Microsoft Employee Posts: 360
    You might be able to find some help in the last couple of posts in this thread:

    http://www.mibuso.com/forum/viewtopic.php?f=32&t=29665&hilit=companies&start=15

    A couple of rules

    period and spaces are replaced with underscore
    trailing underscores are removed
    other special characters become _x<4 digit hex value>_

    So

    CRONUS USA, Inc

    becomes

    CROUNS_USA_x002C__Inc

    (note two underscores before Inc)

    You can always create a small app and request the company names from SystemService - rossb wrote the following code in the other thread:

    // Create instance of service and setting credentials
    SystemService.SystemService service = new SystemService.SystemService();
    service.UseDefaultCredentials = true;
    // Set the service URL
    service.Url = "http://tucvm07:7047/DynamicsNAV/WS/SystemService";

    // Load all companies into an array
    string[] strarray = service.Companies();

    // Run through and print all companies
    foreach (string str in strarray)
    {
    MessageBox.Show(str);
    }

    And to complete this post - we are not really proud of this company name encoding and we are might change this to a standard URL encoding algorithm in the future. SystemService.companies will then of course return the name that works.
    Freddy Kristiansen
    Group Program Manager, Client
    Microsoft Dynamics NAV
    http://blogs.msdn.com/freddyk

    The information in this post is provided "AS IS" with no warranties, and confers no rights. This post does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion.
  • drdr Member Posts: 11
    thx for your help. solved!
Sign In or Register to comment.