我可能错过了一些简单的东西,但我已经厌倦了与之斗争。似乎有很多例子可以连接到股票AIF服务,但我还没有找到一个简洁,有效的例子来连接自定义服务。
假设如下:
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#代码调用每个方法并将结果写入标签?
感谢您的帮助。
答案 0 :(得分: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");
...