Book Image

Microsoft Dynamics AX 2012 R2 Services

Book Image

Microsoft Dynamics AX 2012 R2 Services

Overview of this book

Table of Contents (17 chapters)
Microsoft Dynamics AX 2012 R2 Services
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Consuming services


Now that we have created and exposed our custom services, they can be consumed by other applications. To demonstrate this, we will use Visual Studio and write two code samples.

Example 1 – retrieving titles

The first example of consuming a service deals with the retrieval of a title list. We want to be able to write a list of titles to the console window.

Adding the service reference

To add the service reference, perform the following steps:

  1. In Visual Studio, create a console application just like we did in the previous chapter when testing the document service.

  2. Right-click on the project node and select Add Service Reference…. The Add Service Reference window opens.

  3. In the Address drop-down box, specify http://DYNAX01:8101/DynamicsAx/Services/CVRCustomServices as the address for the service and then click on Go. Of course, replace DYNAX:8101 with the server and WSDL port of your installation. The address is queried and the services and operations that are available are listed...