Professional Documents
Culture Documents
Or-Consuming Web Services Ax2012 PDF
Or-Consuming Web Services Ax2012 PDF
Table of Contents
Introduction ................................................................................................ 3
Audience ..................................................................................................... 3
Prerequisites............................................................................................... 3
Using the Bing API ...................................................................................... 3
Install the Visual Studio tools ..................................................................... 4
Create the service project ........................................................................... 4
Add the service reference ...................................................................................................... 5
Add the project to the AOT ..................................................................................................... 6
Specify the deployment properties .......................................................................................... 6
Verify the service reference .................................................................................................... 7
2
CONSUMING WEB SERVICES
Introduction
The previous version of Microsoft Dynamics AX enabled you to consume external Web services from
X++ code and to consume Web services hosted by Microsoft Dynamics AX from .NET Framework
languages, such as Microsoft Visual C#. To use a Web service, you added a reference in the Web
references form, as described in the Consume Web Services topic on MSDN
(http://msdn.microsoft.com/en-us/library/cc654149.aspx).
Microsoft Dynamics AX 2012 continues to enable Web services scenarios. However, you now use
Microsoft Visual Studio to create and add a reference to a Web service. This white paper walks you
through creating a reference to the Bing API Web service and provides sample code for a job that
consumes the service.
Audience
This white paper is intended for developers who integrate Web services with Microsoft Dynamics AX.
Prerequisites
To benefit from this white paper, you should have experience in the following areas:
You must have Microsoft Visual Studio 2010 installed on the computer that is running Microsoft
Dynamics AX 2012.
3
CONSUMING WEB SERVICES
4
CONSUMING WEB SERVICES
5
CONSUMING WEB SERVICES
4. Click OK.
Name
Value
Deploy to client
Yes
Deploy to EP
No
Deploy to server
Yes
Deploy to SSRS
No
7
CONSUMING WEB SERVICES
In Microsoft Dynamics AX 2012, you construct and configure an instance of a service client object by
using code similar to the following example.
// Retrieve the X++ type for the Bing service client object.
clientType =
CLRInterop::getType("Contoso.ServiceReferences.BingV2ServiceReference.BingPortTypeClient");
// Use the AifUtil class to create an instance of the service client object.
_client = AifUtil::CreateServiceClient(clientType);
9
CONSUMING WEB SERVICES
Note that after the job runs, the following Infolog is displayed.
10
CONSUMING WEB SERVICES
Microsoft Dynamics is a line of integrated, adaptable business management solutions that enables you and your
people to make business decisions with greater confidence. Microsoft Dynamics works like and with familiar
Microsoft software, automating and streamlining financial, customer relationship and supply chain processes in a
way that helps you drive business success.
U.S. and Canada Toll Free 1-888-477-7989
Worldwide +1-701-281-6500
www.microsoft.com/dynamics
This document is provided as-is. Information and views expressed in this document, including URL and other
Internet Web site references, may change without notice. You bear the risk of using it.
Some examples depicted herein are provided for illustration only and are fictitious. No real association or
connection is intended or should be inferred.
This document does not provide you with any legal rights to any intellectual property in any Microsoft product. You
may copy and use this document for your internal, reference purposes. You may modify this document for your
internal, reference purposes.
2011 Microsoft Corporation. All rights reserved.
Microsoft, the Microsoft Dynamics Logo, Microsoft Dynamics, Visual Studio, Visual C#, and Bing are trademarks of
the Microsoft group of companies.
All other trademarks are property of their respective owners.
11
CONSUMING WEB SERVICES