Académique Documents
Professionnel Documents
Culture Documents
Microsoft Dynamics AX
®
www.microsoft.com/dynamics/ax
Table of Contents
Introduction ................................................................................................ 3
With Microsoft Dynamics® AX 2009, external web services usage has been made easier
for developers. By using external web services, Microsoft Dynamics AX 2009 can be
made open to a broader range of applications as well as leveraging existing functionality
that is provided by hundreds of suppliers and vendors. Some of the web services may be
used free of charge, whereas other web services have different licensing models.
This white paper shows the usage of a free web service that enables the automation of
getting currency exchange rates. The web service is free of charge and hosted by a
German vendor.
The first step when integrating external web services is to add a new service reference in
the Application Object Tree (AOT).
1. Logon as a user that has access to the development environment. Make sure you
have a connection to the internet and then do as follows.
2. Open the AOT and navigate to the References node.
3. Right click on References node and select “Add service reference”.
daeNetCurrencyService.CurrencyServerWebServiceSoapClient soapClient;
ExchRate conversionrate;
;
try
{
new InteropPermission(InteropKind::ClrInterop).assert();
CodeAccessPermission::revertAssert();
}
catch(Exception::CLRError)
{
throw error(AifUtil::getClrErrorMessage());
}
}
5. Create a new method in the class called “main” and enter the following code:
// Replace the currencies with the currencies you want to search for
searchResults = daenetCurrencyConverterTest::getRate("USD","EUR",NoYes::Yes);
1. Open the AOT and navigate to the Forms node, locate the form named Currency and
expand the following node:
Designs/Design/[Group:GroupCurrency]/[ButtonGroup:Upper]
2. Right click on [ButtonGroup:Upper],select “New control/MenuButton”, and open the
properties window for the new button.
void clicked()
{
ExchRate exchRate;
ExchRates localExchRates;
EUROTriangulation euroTriangulation;
;
super();
localExchRates.initValue();
localExchRates.CurrencyCode = Currency.CurrencyCode;
localExchRates.FromDate = systemdateget();
localExchRates.ExchRate = exchrate * LedgerParameters::find().ExpressExchRate;
localExchRates.Triangulation = euroTriangulation;
localExchrates.insert();
ExchRates_ds.research();
}
}
}
7. Close the editor window, save and compile the changed form.
1. Open the modified currency form. It now displays the new button Get current
exchange rate
Additional information
For more information about consuming web services in Microsoft Dynamics AX 2009, see
MSDN: http://msdn.microsoft.com/en-us/library/cc654149.aspx
The following internet sites provide a search interface for web services and are examples
of search providers that will enable you to search for web services:
The information contained in this document represents the current view of Microsoft Corporation on the issues discussed as of the
date of publication. Because Microsoft must respond to changing market conditions, this document should not be interpreted to be a
commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of
publication.
This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED, OR STATUTORY, AS
TO THE INFORMATION IN THIS DOCUMENT.
Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of
this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means
(electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of
Microsoft Corporation.
Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject
matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this
document does not give you any license to these patents, trademarks, copyrights, or other intellectual property.