05.11.2013, 21:11 | #1 |
Участник
|
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
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
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, напишите личное сообщение администратору. |
|
|
|