Вопрос

I'm probably missing something simple, but I'm tired of fighting with it. There seem to be quite a few examples for connecting to the stock AIF services, but I have yet to find a concise, working example for connecting to a custom service.

Assuming the following:

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

What C# code would you use to call each method and write the result to a label?

Thanks for the help.

Это было полезно?

Решение

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");

...

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top