Skip to main content

Notifications

Microsoft Dynamics NAV (Archived)

Any Reason why ReadMultiple web method would return 0 records

Posted on by 14,063

I have an integration that calls the ReadMultiple method of the Customer web service. There are 2 NAV databases that are supposed to be configured the same, and with similar data. However, in one database the ReadMulitple returns data as expected, but in the other database the method returns 0 records, even with no filters applied. No errors are returned.

I'm only consuming the web services, and have little knowledge of NAV, but would like to know what could cause this behaviour. Could it be part of the web service configuration, or permissions, or is there anything I can test further ?

This is NAV 2009

*This post is locked for comments

  • Verified answer
    David Jennaway Profile Picture
    David Jennaway 14,063 on at
    RE: Any Reason why ReadMultiple web method would return 0 records

    Thanks all for your help. In the end the issue was with the case of the web service name. In Test it was defined as ABC_CRM_Customer, but in Live it was ABC_CRM_CUSTOMER. This affects the case of the XML elements, and the wrapper that the .Net calling code applies was ignoring elements with the wrong case.

    Due to the code structure, the easiest resolution for this was a find/replace in the reference.cs file that's generated in VS for a Service Reference, and also find/replace in the code files that used the service reference. The one final part of this fix was to ensure we still used the correct ConfigurationName in the ServiceContractAttribute

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: Any Reason why ReadMultiple web method would return 0 records

    From SQL can you open that company table and check if it has any records ?

  • David Jennaway Profile Picture
    David Jennaway 14,063 on at
    RE: Any Reason why ReadMultiple web method would return 0 records

    Thanks for the replies. With SetSize = -1 I still get no records, and the Read operation returns null. Again, no errors in either case.

    I don't have access to NAV (it's maintained by a 3rd party, who I can ask to check things, if there's anything you can suggest ?), but can access the SQL database (though I don't have rights to enable SQL tracing)

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: Any Reason why ReadMultiple web method would return 0 records

    Did you try using Read Operation to read a single customer ? Does it retrieve the customer ?

  • Suggested answer
    Alexander Ermakov Profile Picture
    Alexander Ermakov 28,094 on at
    RE: Any Reason why ReadMultiple web method would return 0 records

    This operation does not throw faults when no matching records are present. Instead, it returns an empty record list. It might be caused by the error in C/AL code. Do you have access to NAV? Try receive the last record by setting SetSize to -1 - what would happen?

  • David Jennaway Profile Picture
    David Jennaway 14,063 on at
    RE: Any Reason why ReadMultiple web method would return 0 records

    Just checked, and the company name doesn't seem to be the problem - we get the same behaviour with or without the '.', and with another company in the database. And trying a deliberately wrong company name throws an http 500 error

    Any other ideas ?

  • David Jennaway Profile Picture
    David Jennaway 14,063 on at
    RE: Any Reason why ReadMultiple web method would return 0 records

    Thanks for the reply. We get no error from the call. We did initially get an error 'You do not have the following permissions on CodeUnit ApplicationManagement: Execute’, but the account was then granted permissions in NAV, and we no longer get the error.

    The company name might be the issue - the url we were given below includes a '.' in the name ('ABC%20LTD.') which looks a bit suspicious, and the working environment doesn't have a '.' in the name - I'll check what happens without the '.', or if I can escape it in the url

    abcsqlserver.abc.local/.../ABC_CRM_CUSTOMER

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: Any Reason why ReadMultiple web method would return 0 records

    Are you getting any error ? Are you querying the right company because in Navision you can have multiple companies and in your URL you need to specify the company name, make sure the company name in URL matches to the company name in the other database.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans