Chapter 6. Web Services

For the better part of this book, we have developed services in Microsoft Dynamics AX and exposed them. However, in this chapter, we will see how to consume a web service from Microsoft Dynamics AX 2012.

In the previous versions of Microsoft Dynamics AX, you could add a web service reference in a reference node in the AOT. This generated proxy classes and other artifacts that you could then use to consume the service. In Microsoft Dynamics AX 2012, we no longer have the option to add service references to the AOT. Instead, Microsoft Visual Studio is used to generate all artifacts, which are then added to the AOT.

How this works and how this can be done will all become clear in this chapter.

The following topics will be covered in this chapter:

  • Installing Visual Studio tools: We have to install additional components because part of the development takes place in Visual Studio 2010. You will learn which components to install and what exactly they do.
  • Visual Studio development: After introducing the demo service, we will create a reference for the services with the help of Visual Studio. We will take you through this process step-by-step.
  • X++ development: Finally, we will demonstrate how we can use the Visual Studio project to consume services in Microsoft Dynamics AX. You will also gain an insight into the different deployment modes that are available to deploy the project's output.

Installing Visual Studio tools

Part of the coding that is needed to consume an external service is performed in Visual Studio. This is why we must install both Visual Studio 2010 and Visual Studio tools for Microsoft Dynamics AX 2012 before we can create Visual Studio projects and add them to the AOT. Although you can develop applications that integrate with Microsoft Dynamics AX 2012 using other versions of Visual Studio, such as Visual Studio 2012, Visual Studio tools are only available for Visual Studio 2010.

To install Visual Studio tools, perform the following steps:

  1. Run the Microsoft Dynamics AX 2012 setup.
  2. Go to the Install section and select Microsoft Dynamics AX Components.
  3. Click on the Next button to move to the next screen and select Add or modify existing components.
  4. Look under the Developer Tools node and select Visual Studio Tools.
  5. Go through the rest of the setup wizard to complete the installation process.

Installing Visual Studio tools will add the following extensions to Visual Studio:

  • The Application Explorer option that is available in Visual Studio by navigating to View | Application Explorer. Enabling it will display the AOT in Visual Studio.
  • Two new templates that are available when you create a new project in Visual Studio — Report Model and EP Web Applications.
  • An option to add Visual Studio projects to the AOT. This is the option we're interested in when consuming web services.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.136.18.141