Question

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.

Was it helpful?

Solution

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

...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top