2012-02-01 116 views
0

我可能錯過了一些簡單的東西,但我厭倦了與它戰鬥。似乎有很多連接庫存AIF服務的例子,但我還沒有找到一個簡明的工作示例來連接到自定義服務。Dynamics AX 2012-AIF使用C#訪問

假設如下:

Service reference configured in the project with a namespace of MyService 

That service has two methods exposed from Dynamics AX that we'll call: 
    helloWorld() and helloWorld2(str yourName) 

Each method returns a simple string 

你會用什麼C#代碼來調用每個方法和結果寫入標籤?

感謝您的幫助。

回答

2
using [MyProjectName].MyService; 

...

MyServiceClient client = new MyServiceClient(); 
CallContext context = new CallContext(); 
label1.Text = client.helloWorld(context); 

MyServiceClient client = new MyServiceClient(); 
CallContext context = new CallContext(); 
label1.Text = client.helloWorld2(context, "test"); 

...