AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
DAX
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск Все разделы прочитаны

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 05.11.2013, 21:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
kamalblogs: AIF: Testing Document services surpassing the AIF setup – Dynamics AX 2012
Источник: http://dynamicsaxlounge.com/2013/11/...amics-ax-2012/
==============

Testing document services is important to ensure that integrations go well. The hard part with testing AX services is that you will have to build SOAP xml’s and then configure AIF. Post that run AIF every time using a File system adapter or other adopter and verify the issues. The difficulties are
  • Running AIF every time
  • Modify the code to get the debugger call
  • If you are a first time user you run through a lot of AIF handling code before you land in the actual document logic.
  • Finding the error statement
Here is a quick job that will alleviate your pain completely.

The job directly feeds/exports the XML through document service class.It straight away starts the document service surpassing the entire AIF and can be used to validate the business logic.The advantages are
  • It is easy to run the test multiple times
  • The xml format is easy and doesn’t require any headers very easy and quick way to validate business logick
  • Doesn’t require you to run the AIF over and over
  • You don’t need to configure AIF
  • It works with AX 2009/AX 2012
End to End testing is very important but this way you can be pretty sure that your business logic works as desired before you go for the full flow testing.

How to use it ? Let us say that you are planning to test the sales order create service.

First you would need a XML to feed in. The best way to create a XML is to export data outside from AX  via the outbound document service.

public AifDocumentXml read(AifEntityKey _aifEntityKey, AifSchemaInfo _xsdInfo, AifEndpointActionPolicyInfo _actionPolicyInfo, AifConstraintList _constraintList, AifPropertyBag _aifPropertyBag){ //throw error(strFmt("@SYS94920")); super(_aifEntityKey, _xsdInfo, _actionPolicyInfo, _constraintListCollection, _aifPropertyBag);}use this code to export the XML from a document service. You can modify this to make it work for any document service.

static void JobTestWebService_ExportXml(Args _args){ AxdAddress address; AxdSalesOrder salesOrder; AifEntityKey key; Map map; //dummy variable AifPropertyBag bag; map = new Map(Types::Integer, Types::Container); //This is the unique index field(natural key based) //if nothing exists then a recid is used. //AxdBase.createEntityKeyFieldList() incase you struggle //finding the key. //map.insert(fieldnum(LogisticsPostalAddress, Recid), ['5637147252']); map.insert(fieldnum(SalesTable, SalesId), ['000001']); key = new AifEntityKey(); key.parmTableId(tablenum(SalesTable)); //key.parmTableId(tablenum(LogisticsPostalAddress)); key.parmKeyDataMap(map); try { address = new AxdAddress(); salesOrder = new AxdSalesOrder(); info(salesOrder.read(key, null, new AifEndPointActionPolicyInfo(), new AifConstraintList(), bag)); // info(address.read(key, null, new AifEndPointActionPolicyInfo(), new AifConstraintList(), bag)); } catch { throw error('Error in document service outbound'); }}Now modify the imported XML with the changes you need. E.g. Remove the SalesId, change the Item code or change the item line. Keep this minimal so what every item you want to test you could already enter in the sales line that you are planning to export and get it exported directly into XML.

All you need to do now to verify your import logic is just run the code mentioned here in a Job. What this code does is it directly calls the AX document service.



static void JobTestWebService_ImportXml(Args _args){ //feed the xml that was modified after exporting through exportxml job XmlDocument xml = XmlDocument::newFile(@'C:\Test1.xml'); AxdSalesOrder salesOrder; try { salesOrder = new AxdSalesOrder(); salesOrder.create(xml.xml(), new AifEndPointActionPolicyInfo(), new AifConstraintList()); } catch { throw error('Error in document service'); }}




Sharpen your SSRS skills. Buy the Dynamics AX reporting cookbook



Keep yourself updated with Dynamics Ax – Check the weekly Must read section here






The post AIF: Testing Document services surpassing the AIF setup – Dynamics AX 2012 appeared first on Dynamics Ax Lounge.



Источник: http://dynamicsaxlounge.com/2013/11/...amics-ax-2012/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
kamalblogs: Dynamics Ax 2012 Reporting cookbook published & 5 reasons why you should go for it Blog bot DAX Blogs 1 20.10.2013 15:12
crminthefield: Podcast and Overview: Microsoft Dynamics CRM 2011 Update Rollup 10 Blog bot Dynamics CRM: Blogs 0 17.08.2012 03:27
ax-erp: Creating SSRS-Reports in Dynamics AX 2012 – What’s no longer possible in AX-reports Blog bot DAX Blogs 0 18.07.2012 12:11
dynamicsaxtraining: Purchase Blog bot DAX Blogs 0 11.03.2012 05:25
dynamics-ax: Modeling the world, with Microsoft Dynamics AX 2012 Blog bot DAX Blogs 0 25.01.2011 09:11
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 21:00.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.