NAV Http Web Request

In my post about Json and Rest web services I showed how to use the standard Codeunit no. 1297 for web service communication.

Today I was asked to do this in NAV 2015.  I must admit, I forgot that this Codeunit was not available in NAV 2015.

So I made one.

This one has identical functionality to the one delivered with NAV 2016.  To catch and handle the errors I use the NAV Web Request Add-in that I created and published here on my blog.

Now I can easily move that Json code down to NAV 2015.

Download here –> COD1297-NAV2015

16 Replies to “NAV Http Web Request”

  1. Is it possible to use this on NAS? Whenever I try it and web request returns any value I get the client callback error. It is ok whenever there is no return from the webservice.

      1. Thank you Gunnar, of course I disabled it :). Even if I wouldn’t do it manually, the default value is GUIALLOWED which would disable it on the server based actions anyway. The error is not complaining about any particular function (which I think would be the case if any message or dialog was invoked), but the dotnet variable which is returning a webservice result. I was thinking that maybe it is trying to open some security data collection dialog or error because of job queue or NAS service settings… but can’t figure out why.

  2. Job queue works fine for all entries apart of this one (which is full update of all items on the Kentico website) – and the both job queue log and debug are returning exactly the same message: ‘Microsoft Dynamics NAV Server attempted to issue a client callback to create a DotNet object: System.Net.HttpStatusCode (CodeUnit 1297 Http Web Request Mgt.). Client callbacks are not supported on Microsoft Dynamics NAV Server’. I can suppress the HttpStatusCode and assume it is always successful – which is obviously terrible practice, but then I receive exactly the same error, but referring to HttpWebResponse instead. With HttpStatusCode suppressed and nothing in HttpWebResponse it works OK as no data is coming back to NAV – but this isn’t helpful for any Item Creations as they need to return the GUID to NAV.

      1. If you mean the NAVwebrequest.dll – this is what I’m doing – or actually you are doing as it is NAV 2015 and I’m using your custom made CU 1297 as per this article and NAVwebrequest.dll is one of the necessary elements there :).

  3. Hi Gunnar, I am getting error message while I send request using NAVWebRequest.dll. in Navision 2016. Please Suggest.
    Microsoft Dynamics NAV
    —————————

    Error: SendFailure
    The underlying connection was closed: An unexpected error occurred on a send.
    —————————
    OK
    —————————

  4. I try to adapt this in NAV 2013 R2 but I’m getting the following error.

    Microsoft Dynamics NAV
    —————————

    Cannot create an instance of the following .NET Framework object: assembly NAVWebRequest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f53f0925d26e1382, type NAVWebRequest.NAVWebRequest.
    —————————
    OK
    —————————

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.