AX 2009 生成WCF服务

 

AX2009生成WCF服务

实现步骤

一,准备AIF环境

1,Rerun the setup.exe that installs Microsoft Dynamics AX.

2,Click the Add or modify components option.

3,Select AIF Web services. This install cannot succeed unless .NET Business Connector is already installed.

4,As you click Next to continue through the forms of the setup wizard, you see a form that suggests a default name for the virtual directory. Write down the name for the virtual directory, for later reference.

二,新增AIF 网站

1,进入AX2009,找到基本设置->设置->应用程序框架->网站。

2,在网站上窗体上新增一条记录,填写名称和虚拟目录共享路径,(需要注意的是在安装AIF后,会在C:\Program Files\Microsoft Dynamics AX\50\生成一个AifWebServices的共享文件夹,在IIS的Default Web Site下会生成一个MicrosoftDynamicsAXAif50的站点。),在填写虚拟目录共享路径时需要找到AifWebServices文件夹的共享网络路径,然后copy该路径到网站的虚拟目录共享路径。

具体操作截图

三,新增Service

1,首先新增一个class,在class新增method,需要注意的,在新增class后,需要修改class的RunOn属性为server

 

2,添加Service,添加Service是需要在属性中填写Namespace为“http://schemas.microsoft.com/dynamics/2008/01/services”,在class属性中填写你新增的类,新增完Service后,然后新增Operations如图:

 

 

 

四,添加服务

1,进入AX2009,找到基本设置->设置->应用程序框架->服务

2,点击刷新按钮,找到在第三步中新增的Service,勾选已启用按钮,然后点击生成按钮,如图:

 

点击生成后

 

五,测试生成的WCF服务

1,打开IIS,找到Default Web Site->MicrosoftDynamicsAXAif50,鼠标右键,找到管理应用程序->浏览,并记下浏览地址,如图:

 

六,在vs2008引用该WCF服务

1,打开vs2008,新增一个window 应用程序

 

2,在新增的window 应用程序中,添加一个服务引用

 

3,在弹出的对话框的地址栏里填写之前几下的IE地址

 

4,展开Services下的节点,在操作中我们就可以看到我们新增的Method

posted @ 2012-06-28 13:21  adingkui  阅读(868)  评论(1编辑  收藏  举报