Need NAS to communicate with a web service ?

My recent post on creating a class in visual studio to simplify the NAV C/AL code for web service is a easy solution for NAV 2013.  It will work both for the user and for the Job Queue.  In NAV 2009 it will also work for the user running the Role Tailored Client but it will not work in the Job Queue.

There is a solution.  Use the VB.NET NAV Application Server.  This application server is able to execute any codeunit in NAV with dotnet support. 

The license required to start this application server is also cheaper than the classic NAS license.

Use WSDL and dotnet interop in the Role Tailored Client

I have been working with the dotnet interop and consuming soap web services.  I wrote about a dotnet interop based way to communicate with soap web services in a previous blog but now I want to demonstrate another way that requires just a few lines of code.

I would like to find a web service that is open so everyone can do their own testing.  I found a web service that will look up a country by an IP address.

The first step is to start Microsoft Visual Studio and create a new project.  The language that you choose is not important.

I delete Class1.cs.  Then go to Project menu and Add Service Reference.  Click Advanced… and Add Web Reference…  Look in my previous blog for more details.

I paste the web service URL in to Visual Studio and select a name for the web reference.

I go to Project and GeoIPService Properties to make sure that I am using .NET Framework 3.5 and I choose to create my own key to sign the class.  I also like to add details to the Assembly Information…

I go to Signing and create a new key file with my own password.

Then I save the project and select Build and Build GeoIPService.  In the solution folder I will now find the GeoIPService.dll file.  This file I copy to my Classic Client Add-ins folder.  I start the Classic Client and create a new Codeunit.  I will then add a dotnet global variable with my new class.  I create a variable both for GeoIPService and for GeoIP.

I the need to choose if I would like the service to be run on the client or on the server.  If I choose to run on the client then I need to copy the class file to Role Tailored Client Add-ins folder for every user.  If I choose to run on server I copy the class file to the service Add-ins folder.  I selected to run on server since I do not have to supply my domain user name or any certificates to the service.

The code in the Codeunit is as follows

[code]
GeoIPService := GeoIPService.GeoIPService;
GeoIPService.Url := ‘http://www.webservicex.net/geoipservice.asmx’;
GeoIP := GeoIPService.GetGeoIP(‘93.95.74.198’);
MESSAGE(
‘Return Code: %1\IP Address %2\Country Name: %3\Country Code: %4’,
GeoIP.ReturnCode,
GeoIP.IP,
GeoIP.CountryName,
GeoIP.CountryCode);[/code]

I then start the codeunit in my Role Tailored Client with the Run Object Page that Microsoft supplied in their blog.

Attached is the codeunit, the class library and the Run Object Page from Microsoft.

GeoIPService

A message from Dan Brown, General Manager Dynamics NAV

This is a message to you all from Dan Brown General Manager, Dynamics NAV:

Hi, everyone.

Over the past several months the NAV team has worked hard getting ready to release Microsoft Dynamics NAV 2013. We’ve run hundreds of thousands of performance-, stress-, unit- and regression-tests daily. We’ve monitored the comments you’ve made on our first-ever public Beta of NAV and incorporated the feedback as much as possible. And, we’ve worked with partners bringing several customers live on NAV 2013. All of this has been to ensure that the product is of the highest possible quality before we ship. We’re looking forward to getting the RTM version in your hands as soon as possible!

Microsoft Dynamics NAV 2013 is probably the biggest launch of the product ever. It concludes the transition from the classic client/server 2-tier proprietary architecture developed in the 1990’s to a state-of-the-art, 4-tier Microsoft architecture capable of rendering multiple clients and facilitating multiple modes of integration. It also means that Microsoft Dynamics NAV now is a full-blown member of the Microsoft server family and adheres to all Microsoft standards in terms of security, reliability and scalability. Finally, it signals the beginning of a new era of “NAV in the cloud,” opening up an array of new opportunities using NAV and integrating it with Microsoft and non-Microsoft products.

With Microsoft Dynamics NAV 2013 coming out this fall, the NAV TechDays conference is a great opportunity for everybody in the NAV developer community to learn more about and get ready for the release. All the sessions at NAV TechDays are technical and long enough to allow the speakers to go into enough detail for the developers in the audience to understand what the features in the product are about and how to use them. Since NAV TechDays is a conference for developers by developers with deep technical content, we are sending some of our best developers who designed and wrote the code to attend and speak at the conference. If you have questions about your favorite feature, you will have an opportunity to give your feedback on Microsoft Dynamics NAV 2013 and provide input on what you would like to see in future releases.

I hope to see you all at NAV TechDays in Antwerp, Belgium on September 27th.

-Dan

____________________________________
Daniel C. Brown
General Manager, Dynamics NAV

NAV 2013 and ClickOnce Install

I have installed NAV 2013 on a Windows 2008 Server.  Everything is working fine and it is time to create the OneClick installation source.  I followed the documentation from Microsoft.  Make sure that when you install NAV 2013 to select ClickOnce Installer Tools.

I first found that the SDK needed for the mage.exe command is not available on the server.  I downloaded and installed Microsoft Windows SDK for Windows 7 and .NET Framework 4 from Microsoft.

I created the folder C:\inetpub\wwwroot\NAV2013Beta as the source for deployment and the folder C:\inetpub\wwwroot\NAV2013Beta\Deployment\ApplicationFiles for the application.  I created a read only share for the folder NAV2013Beta.  I copied everything from the folder C:\Program Files (x86)\Microsoft Dynamics NAV\70\RoleTailored Client to this folder.

I found the folder C:\ProgramData\Microsoft\Microsoft Dynamics NAV\70 and copied the ClientUserSettings.config file to my C:\inetpub\wwwroot\NAV2013Beta\Deployment\ApplicationFiles folder.  First I made sure that the server was not set to localhost but to the network server name.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <appSettings>
    <!--
      Name of the machine hosting the Microsoft Dynamics Nav Server to
      be connected to.
    -->
    <add key="Server" value="nav2013.dynamics.is"/>

I found the folder C:\Program Files (x86)\Microsoft Dynamics NAV\70\ClickOnce Installer Tools\TemplateFiles and copied all files to my C:\inetpub\wwwroot\NAV2013Beta folder, selecting to merge the Deployment folder.

Next I opened Command Prompt and typed

set PATH=%PATH%;C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\NETFX 4.0 Tools;C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin
cd "\inetpub\wwwroot\NAV2013Beta\Deployment\ApplicationFiles"
mage.exe -Update Microsoft.Dynamics.Nav.Client.exe.manifest -FromDirectory .\

I got the following errors

Warning MSB3112: Two or more assemblies have the same identity 'Microsoft.Dynamics.Nav.OpenXml, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35, ProcessorArchitecture=msil'.
Warning MSB3182: File name 'C:\inetpub\wwwroot\NAV2013Beta\Deployment\ApplicationFiles\Add-ins\CodeViewer\EditorComponents\Microsoft.VisualStudio.UI.Text.Wpf.KeyProcessor.Implementation.dll' exceeds 100 characters.

Microsoft.Dynamics.Nav.Client.exe.manifest successfully updated. However, some errors were encountered.

Decided to remove the Development Client and only install the Role Tailored Client and restarted the process and got a better result.

Microsoft.Dynamics.Nav.Client.exe.manifest successfully updated

Continuing in the command prompt

cd ..
mage.exe -Update Microsoft.Dynamics.Nav.Client.application -AppManifest \\nav2013\NAV2013Beta\Deployment\ApplicationFiles\Microsoft.Dynamics.Nav.Client.exe.manifest -AppCodeBase \\nav2013\nav2013beta\Deployment\ApplicationFiles\Microsoft.Dynamics.Nav.Client.exe.manifest
mage.exe

I change the Name to identify the installation

I changed the description

and I needed to change the Start Location

Again, I saved the file selecting not to sign it.

In my \\nav2013\NAV2013Beta folder I used Word to create the Software License Terms for my company and saved is as Rich Text Format as PartnerSolutionLicense.rtf.

Then I opened the NAVClientInstallation.html file in Notepad and removed the TODO both for the text and for the link.

Next I tried the installation by browsing to the folder \\nav2013\NAV2013Beta on a Windows 2008 Remote Desktop Server and double clicking on NAVClientInstallation.html file.  After a few click I had my NAV 2013 Beta up and running.