Options

Web service vs NAV Client 2017 context of execution

zpgmzpgm Member Posts: 6
Hi all,

I have a question regarding a web service call and the code execution context in NAV 2017.

I have a card page which has an action to post the document. After some validations and using CODEUNIT.RUN(CODEUNIT::"MyCodeunit_name", MyTable), the post routine generates an XML that will be used in a DLL (it is a certified functionality created by some partner we had) to send encrypted data to some governmental agency.
Everything works fine when running in the NAV 2017 client.

Our company is taking out of NAV a couple of personalized developments and one of them is this page, though we must use the DLL to communicate with the governmental agency!

So, in an MVC project and using stored procedures I can insert/update data in the NAV 2017 database. I published a codeunit web service, that mimics the page action described, to use the same business logic.
The problem resides in the DLL method that is called: when running on the NAV Client it executes perfectly; but when is the web service codeunit to execute the call, it fails with the error "MyDll.MyMethod failed with this message: Object reference not set to an instance of an object".

My first thought was DateTime data types, Time Zones and the way NAV manages this issue, but debugging the NAV 2017 web service call every DateTime field has correct and consistent value (I don't know what the DLL code does).

Could the scope of execution (client vs web service context of execution) being the cause of this error?

Thank you.

Comments

Sign In or Register to comment.