返回秋毫ERP咨询论坛

- 微软ERP Dynamics AX,Nav,CRM,SL专业论坛,同时包括SAP,Oracle ERP讨论和相关文档下载。



返回本书目录


Previous Page
Next Page

Inside the Business Connector

As stated earlier, the Business Connector is a versatile platform component. The Business Connector itself comprises two components: one that provides Microsoft COM interoperability, and another that provides interoperability with the .NET Framework. You should choose the component that is appropriate to the environment in which you are working. Both Business Connector components contain the Dynamics AX kernel and provide a run-time environment for executing X++ code and interacting with other elements in the AOT. This is because virtually the entire Dynamics AX development and run-time environment is based on X++, and the kernel is responsible for interpreting and executing this code.

Table 8-1 summarizes the primary characteristics of the two types of Business Connector.

Table 8-1. Business Connector Characteristics

Characteristic

COM Business Connector

.NET Business Connector

Single-user with single-session or multi-session support (desktop PC deployment)

Yes

Yes

Multi-user and multi-session support (Web or other server deployment)

Yes

Yes

Microsoft COMbased interface

Yes

No

.NET Framework 2.0 managed classes

No

Yes

Integration with the managed HTTP context (for enabling Web applications)

No

The COM Business Connector in the previous version supported the unmanaged HTTP context, but Dynamics AX 4.0 does not.

Yes

CLR interoperability available

Yes

Yes


As you can see, the Business Connector versions are largely similar, differentiated only by managed HTTP context integration and the programming environment for which each is intended.

The Logical Component Stack

If you divide the .NET Business Connector into its constituent parts, you will see that the following three logic components (illustrated in Figure 8-2) interoperate to deliver functionality:

  • Managed classes

  • Transition layer

  • Interpreter

Figure 8-2. The logical component stack in the .NET Business Connector.


Managed Classes

The managed classes component is a set of .NET Frameworkbased classes that expose functionality that can be accessed through the .NET Business Connector. It includes the following classes: Axapta, AxaptaBuffer, AxaptaContainer, AxaptaObject, and AxaptaRecord. The purpose of each of these classes is described later in this chapter, in the section called "Working with the .NET Business Connector." If you used the COM Business Connector in the previous version of the application, you will find that the functionality of the managed classes in Dynamics AX 4.0 is mostly equivalent.

The Transition Layer

The transition layer is where the mapping occurs between .NET Framework objects and types and their Dynamics AX equivalents, as part of both request and response processing associated with the use of the Business Connector.

The Interpreter

The interpreter consists of the kernel. Dynamics AX allows code to be executed locally in the Business Connector AX kernel or remotely in the AX kernel of the AOS. The interpreter manages local and remote code execution. It also manages connectivity to the AOS and other infrastructure, such as session management and security.

Run Time

At run time, both types of Business Connector interact with the AOS because the two-tier model is not supported in Dynamics AX 4.0. The diagram in Figure 8-3 depicts the run-time interaction.

Figure 8-3. The Business Connector run-time interactions.


The important interactions among the Business Connector, the AOS, and the AX database are as follows:

  • The Business Connector authenticates against the AOS when the Axapta.Logon() method is called. The credentials passed to the AOS by the Business Connector must correspond to an existing Dynamics AX user, who must be enabled and have the appropriate rights, granted through security keys, to use the Business Connector.

  • The AOS completes the authentication and establishes a session for the Dynamics AX user.

  • Other Business Connector classes and methods are invoked as needed. Data in Dynamics AX can be selected, inserted, updated, and deleted by using the Business Connector through the AOS. In addition, the X++ business logic that resides in the Dynamics AX metadata store, the Application Object Directory (AOD), can be invoked and executed either on the AOS or in the Business Connector itself.

Web Interoperability

The Dynamics AX development environment includes a feature known as the Web framework. This is covered in more detail in Chapter 10, "The Enterprise Portal." The Web framework is used to develop the Web-based functionality in X++, which is then exposed in the Dynamics AX Enterprise Portal (EP). However, Web applications generally must interact with the HTTP context data, which typically includes the request, response, view state, and so forth. The Dynamics AX EP uses the .NET Business Connector to integrate with Dynamics AX, and the .NET Business Connector can interoperate with Internet Information Services (IIS) and Microsoft ASP.NET to provide access to the HTTP context information necessary to enable Web-based functionality. Note that in earlier versions of Dynamics AX, the COM Business Connector integrated with the unmanaged HTTP context as part of the interoperability with Active Server Pages (ASP). This is no longer supported.

The diagram in Figure 8-4 illustrates how Web interoperability works.

Figure 8-4. .NET Business Connector Web interoperability.


Managed Web applications, including the Dynamics AX EP, execute in IIS within an application domain. Upon initialization, the application domain loads and instantiates the .NET Business Connector. The managed application then uses the .NET Business Connector to invoke Dynamics AX Web framework elements, such as Web menu items, Web forms, and Web reports. The X++ code stored in the AOD that defines these elements accesses the HTTP context as needed through the following classes (located in the AOT under System Documentation\Classes):

  • IISApplicationObject

  • IISContextObject

  • IISPostedFile

  • IISReadCookie

  • IISRequest

  • IISRequestDictionary

  • IISResponse

  • IISServer

  • IISSessionObject

  • IISStringList

  • IISVariantDictionary

  • IISViewState

  • IISWriteCookie

For example, you could write an X++ class to retrieve a variable from the HTTP context, which you could then use in another X++ class. In the following code example, the method takes a parameter, which is the name of the HTTP context variable, the value of which will be obtained using IISRequest().

str getIISServerVariable(str 80 var)
{
    IISRequest request;
    str res;

    request = new IISRequest();
    res = request.serverVariables().itemTxt(var);
    return res;
}


If you want to develop a new, custom Web-enabled application that integrates with Dynamics AX and can access managed HTTP context information, you can use both ASP.NET and the .NET Business Connector. The interoperability among IIS, ASP.NET, and the .NET Business Connector allows you to access HTTP context information from X++ code that is part of your application.

Important

Existing applications developed with the previous version of the COM Business Connector and ASP that accessed the unmanaged HTTP context must be migrated to ASP.NET to successfully run with Dynamics AX 4.0.


Security

A significant amount of effort has been expended on enhancing security within Dynamics AX 4.0. This section highlights the security mechanisms in place for the Business Connector.

Authentication

Microsoft Windows authentication is implemented throughout Dynamics AX 4.0, and this change is reflected in both types of Business Connector. The COM interface (COM Business Connector) and the managed classes (.NET Business Connector) have been refactored to accommodate parameters that are specific to Windows authentication.

Authorization

The Business Connector has an associated set of Dynamics AX security keys that control access to different parts of the Business Connector functionality. Table 8-2 describes these security keys.

Table 8-2. Dynamics AX Security Keys

Security key

Description

SysCom

Enables or disables the use of either type of Business Connector

SysComData

Controls the level of access that users have to data

SysComExecution

Controls access to execution rights of classes and jobs in the Business Connector

SysComIIS

Controls whether the Business Connector is accessible to users when running in the context of IIS


These keys can be browsed in the Data Dictionary under Security Keys. You can control the use of the Business Connector in different user groups in Dynamics AX by configuring these security keys.

Code Access Security

Code Access Security (CAS) is a new feature in Dynamics AX 4.0. CAS is a mechanism intended to help Dynamics AX developers write code that invokes protected X++ APIs in a manner that minimizes the potential for malicious exploitation of these APIs. A protected API is an X++ API method that has been secured by using CAS. It also ensures that the protected APIs are executed only on the AOS, not on the Dynamics AX client or the Business Connector. CAS therefore restricts the X++ APIs that can be executed locally in the Business Connector. If such an attempt is made, a CAS exception is returned.


Previous Page
Next Page