• 716-472-4484
  • ptsteadman@gmail.com

NAV Web 服务编程资源


以下是我在学习开发基于 Dynamics NAV Web 服务的应用时觉得有帮助的一些资源。

C/AL 编程:

Introduction to CAL Programming
这份资料对 CAL 编程基础做了不错的概览。当你需要自定义 codeunit 或页面扩展来构建 Web 服务应用时,这些基础知识会变得很有必要。

Web 服务配置:

Vjecko Web Service Recorded Session
Vjecko.com 有很多关于 Web 服务编程的详细文章,这篇较老的文章附带 PDF 和录制视频,展示了如何在 .NET 应用中发布并连接 Web 服务。可惜他演示的是 .NET 中早已弃用的 Web Reference 方法(.NET 2 时代),而不是更新的 Service Reference 方法。

Using Service Reference to Connect to Web Services
这篇文章讲解了如何使用 Service Reference,并通过代码替代 XML web.config 配置。我发现后者很难配置(每次更新 service reference 都要重新改 XML)。

Migration to SQL Server from C/SIDE Database
为了使用 Web 服务,你不需要使用 Role Tailored Client,但必须使用基于 SQL Server 的 NAV 数据库。你可以用 Classic Client 为 SQL Server 数据库配置并发布 Web Services。

Debugging Code Called by Web Services
C/AL 代码在被当作 Web Service 调用时,执行方式不一定和 Classic Client 中一样。作为 Web Service 运行的 C/AL 代码是在 NAV Server 层执行,而不是客户端。某些函数在 NAV Server 上不可用,同时也需要做一些设计调整(例如在 Web Service 场景下,CONFIRM 对话框并不合适)。要调试通过 Web Services(或 Role Tailored Client)调用的 codeunit,需要使用 Visual Studio。
More information.

部署 .NET 应用:

Deploying to IIS After you’ve built a .NET application that consumes .NET web services, you’ll have to find a way to deploy it on your servers, or Azure. Connection strings can be used to specify different NAV servers for different environments (like development, QA, and prod).
Deploying to IIS 在你构建好一个调用 .NET Web 服务的 .NET 应用之后,你需要把它部署到服务器或 Azure。连接字符串可用于为不同环境(如开发、测试、生产)指定不同的 NAV 服务器。