web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Maintain Request log in navision. while importing data into navision from external systems.

(0) ShareShare
ReportReport
Posted on by 2,205

Hi Expert,

I am integrating the third-party application with navision where i am taking data into navision system with the help of XMLPort & Soap services. integration is working fine. my problem is i am unable to main the request log.  because if any error comes from network or any unknown issue due to which data didn't comes into navision. I am unable to check to request log. so i want to check the all request coming to navision and what is its status.

while searching my problem, i was come to know about Activity log functionality. but unable to understand. Is Activity log functionality will help me out.

i was reading the below blog.

https://community.dynamics.com/nav/w/designpatterns/243.activity-log

Please suggest any solution of my problem.

*This post is locked for comments

I have the same question (0)
  • Stefano Demiliani Profile Picture
    37,172 Most Valuable Professional on at

    What do you mean by “Request log”? If you’re using SOAP to load data on NAV and a SOAP request fails, you need to log the error on your application. We can surely help if you can give us more details on what you want to do.

  • sanjeet Profile Picture
    2,205 on at

    thanks Stefano,

    Sure, I am unable to know how many request attempt was tried to push data into navision  and how many data fails to reach in navision table. due to any unknown reason. may be network or etc.

    for example : if third party application try to push Data into navision by calling navision soap services, and they get error like table locked or any unknow error. due to which data doesn't comes into navision table. so in this scenario i am unable to know about that data. in this case i have to go data sender system and call for request log they pushing & response received from navision .

  • Stefano Demiliani Profile Picture
    37,172 Most Valuable Professional on at

    When an external app calls a NAV WS via SOAP, the request from the endpoint is forwarded to the internal logic of NAV. What object type do you publish as WS? A page I suppose? In the OnInsert you can log in NAV the operations (via C/AL) but if NAV throwns an exception, this is returned to the client application. You don’t have try catch in NAV for handling it internally. You can implement a robust integration layer if you don’t expose the NAV object directly but you create a “middle tier” that wraps the external request and forwards it to NAV. In this scenario you can log everything you want.

  • sanjeet Profile Picture
    2,205 on at

    I am using Codeunit to Publish asWS.

  • Stefano Demiliani Profile Picture
    37,172 Most Valuable Professional on at

    You can use also a TryFunction codeunit and publish it as a WS.

    For example, if you're loading Items in NAV by calling a WS codeunit, create a function call AddItem (with the code you want on it) on your published codeunit and set the TryFunction attribute to YES.

    Then you can create a public method call StartAddItems that in turns call your AddItem function as below:
    CLEARLASTERROR();
    IF AddItem(...) then
    //insert is ok
    else
    //log the result of GETLASTERRORCODE and GETLASTERRORTEXT system variables

    Your external application will call the StartAddItems method of the published codeunit.

  • Suggested answer
    keoma Profile Picture
    32,729 on at

    for web services you can catch webexception, if an error/exception occurs. this class has property response, which contains the remove server error message.

  • Stefano Demiliani Profile Picture
    37,172 Most Valuable Professional on at

    The problem requested here is to log from NAV an incoming call that comes from an external app and that invokes a published method in a codeunit exposed as WS. WebException is thrown to the caller if an unhandled error occours in NAV. The best method to handle an error in NAV, log it and return an exception (or a custom error) to a client application is to use a TryFunction as described above.

  • Suggested answer
    keoma Profile Picture
    32,729 on at

    your best chance would then be to develope a windows service with c# that interacts with the external sources and catches and logs all errors using c# error/exception handling. data is then forwarded from there to nav using web services. so you can control the whole system.

  • sanjeet Profile Picture
    2,205 on at

    Thanks Jonathan, I am also thinking the same. but unable to understand how to start.

    Since i am using codeunit to publish as web service. In my codeunit there is 1 method having xml as parameter which import data into navision. Before that i have to write C# code to log request which is coming.

    Could you please suggest the process.

  • Stefano Demiliani Profile Picture
    37,172 Most Valuable Professional on at

    Is it not closed this thread?

    As explained, there are 2 ways for logging requests: if you want to do it via C# in the client program, you simply have to handle exceptions returned by NAV WS.

    If you want to log exceptions from INSIDE NAV (I think this is your problem) you can do like the following:

    [View:https://demiliani.wordpress.com/2018/01/22/handling-exceptions-inside-nav-when-using-web-services-integration/]

    Here, you avoid that an NAV exception returns the error to the client but you “trap” it.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans